> Documentation index: https://sema4.ai/docs/llms.txt
> Web page: https://sema4.ai/docs/v3/admin/connections/data-sources/postgres

# Postgres

Connect a Postgres database so Projects can query your operational tables, analytical replicas, or managed Postgres services. The same form covers vanilla Postgres and Neon; TimescaleDB has its own form variant in the Catalog and is covered in [Connect non-Snowflake providers](https://sema4.ai/docs/v3/admin/connections/data-sources/non-snowflake-providers.md).

**Audience:** IT (the enabler)

## Capability profile

Read-only by design. Point connections at an analytical replica when one exists, and create a least-privilege role for the platform rather than reusing an application role.

## Who can connect this

Workspace admins and the active team's admin. New connections land in the active team.

## What you need

- The host and port (defaults to `5432`).
- Database name, username, and password.
- An `sslmode` value (typically `require` for managed services; `verify-full` when verifying the server certificate) and an optional `channel_binding` value.
- Network egress from the platform to the database host, plus an inbound rule on the database for the platform's source IPs. For the hosted service, see [Exit IP addresses](https://sema4.ai/docs/v3/admin/connections.md#exit-ip-addresses).

> **SSL on managed Postgres.** Neon, RDS, Aiven, and Supabase reject unencrypted connections. Set `sslmode=require` at a minimum. When the form detects a Neon host, it defaults missing SSL options to `sslmode=require` and `channel_binding=require`.

## Connect Postgres

### Open the Postgres catalog tile

On the Data Sources page's **Catalog** tab, click **Create** on the Postgres tile. The shared composer opens.

### Paste a DSN or fill the form

_Screenshot: Create Postgres connection: the Paste connection details box above the Name, Host, Port, Database, Username, Password, SSL mode, and Channel binding fields_

The **Paste connection details** section accepts PG-compatible env blocks, `postgresql://` URLs, and key=value DSNs. The form below populates from the paste. To fill manually, set **Host**, **Port**, **Database**, **Username**, and **Password**.

### Set SSL options

Set **SSL mode** to the value your server requires. Add a **Channel binding** value when the server enforces it. Other Postgres parameters paste into the **Additional options** record and are preserved on save.

### Save and verify

Name the connection (admins see this in the **Connected** tab) and click **Create**. Open the connection's drawer and click **Run test** to verify connectivity, then watch the **Readiness** tiles fill in as discovery runs.

## Required Postgres privileges

The connecting role needs `CONNECT` on the database, `USAGE` on each schema in scope, and `SELECT` on the tables and views the platform should read. For broad coverage on a stable schema set:

```sql
GRANT USAGE ON SCHEMA public TO platform_reader;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO platform_reader;
ALTER DEFAULT PRIVILEGES IN SCHEMA public
  GRANT SELECT ON TABLES TO platform_reader;
```

Repeat per schema. The default-privileges line keeps the role current as new tables land.

## Network access

The composer does not include a bastion or SSH tunnel field. When the database sits behind a private network, place a TCP proxy (a managed bastion or a cloud-provider Private Service Connect endpoint) in front of it and point **Host** at the proxy. Allow the platform's source IPs in the database firewall or security group. For the hosted service, use the [exit IP addresses](https://sema4.ai/docs/v3/admin/connections.md#exit-ip-addresses). For a self-hosted deployment, get the egress IPs from your platform operator.

## Common errors

- **`SSL connection is required`.** The server refuses unencrypted connections. Set `sslmode=require` (or stronger).
- **`role X does not have permission`.** The role lacks `USAGE` on the schema or `SELECT` on a table. Grant the missing privilege and re-test.
- **`channel binding required`.** Set `channel_binding=require` to satisfy the server.
- **`timeout`.** Network egress, the database firewall, or the bastion is blocking the connection. Confirm the host and port reach the database from the platform.
- **Schema search path mismatch.** When tables live in a schema other than `public`, choose the tables by schema when [attaching the source](https://sema4.ai/docs/v3/build/data/attach-source.md) rather than relying on the database's search path.

## See also

- [Snowflake](https://sema4.ai/docs/v3/admin/connections/data-sources/snowflake.md) for the dedicated dialog and Profiles tab.
- [Connect non-Snowflake providers](https://sema4.ai/docs/v3/admin/connections/data-sources/non-snowflake-providers.md) for TimescaleDB, MySQL, MSSQL, Oracle, BigQuery, Databricks, Redshift, and ClickHouse.
