> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alumio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PostgreSQL

> Database connection for PostgreSQL

export const FormField = ({property, label, required = false, diType, uiPatterns, children}) => {
  const patterns = Array.isArray(uiPatterns) ? uiPatterns : uiPatterns ? [uiPatterns] : [];
  return <div style={{
    margin: '1.5rem 0'
  }}>
      <div style={{
    display: 'flex',
    alignItems: 'baseline',
    flexWrap: 'wrap',
    gap: '0.5rem',
    marginBottom: '0.25rem'
  }}>
        <strong>{label}</strong>
        <span style={{
    fontSize: '0.7rem',
    fontWeight: 600,
    textTransform: 'uppercase',
    letterSpacing: '0.04em',
    color: required ? '#6241f5' : '#6b7280'
  }}>
          {required ? 'Required' : 'Optional'}
        </span>
      </div>

      <div>{children}</div>

      {diType || patterns.length > 0 ? <p style={{
    fontSize: '0.85rem',
    color: '#6b7280',
    marginBottom: 0
  }}>
          {diType ? <>
              See the <a href={`/references/${diType}`}>{diType}</a> reference.{' '}
            </> : null}
          {patterns.length > 0 ? <>
              Accepts a <a href={`/documentation/placeholders-and-patterns/patterns#${patterns[0]}`}>pattern</a>.
            </> : null}
        </p> : null}
    </div>;
};

Use this to connect Alumio to a PostgreSQL database server. Once it is set up, the connection can be reused by other features that read from or write to your PostgreSQL database, so you only supply where the server lives and how to sign in once.

This documentation describes: [Schema](/schemas/database-connection/postgresql)

## Fields

<FormField property="host" label="Server host" required>
  The address of the PostgreSQL server, for example `db.example.com`. This can be a domain name or an IP address.
</FormField>

<FormField property="port" label="Port">
  The network port the server listens on. If you leave this empty it defaults to `5432`, the standard PostgreSQL port. Change it only if your server uses a different port.
</FormField>

<FormField property="dbname" label="Database name" required>
  The name of the database on the server that you want to work with.
</FormField>

<FormField property="username" label="Username">
  The username used to sign in to the database server. Leave it empty to connect anonymously.
</FormField>

<FormField property="password" label="Password">
  The password used to sign in. You can reference an environment variable here instead of typing the secret directly.
</FormField>

## Sample data

A typical PostgreSQL connection:

| Field         | Value                      |
| ------------- | -------------------------- |
| Server host   | `your-db-host.example.com` |
| Port          | `5432`                     |
| Database name | `warehouse`                |
| Username      | `integration_user`         |
| Password      | `your-password`            |

```json theme={null}
{
    "host": "your-db-host.example.com",
    "port": 5432,
    "dbname": "warehouse",
    "username": "integration_user",
    "password": "your-password"
}
```

Connection credentials are shown here as placeholders. For the password you can reference an environment variable instead of typing the secret directly; see [Placeholders](/references/placeholders) for the full syntax.

```json Configuration theme={null}
{
  "prototype": "postgresql",
  "parameters": {
    "host": "your-db-host.example.com",
    "port": 5432,
    "dbname": "warehouse",
    "username": "integration_user",
    "password": "your-password"
  }
}
```
