Connect PostgreSQL to Contextflo

Create a read-only Postgres user and connect your database to Contextflo

Last updated: 8/19/2026

Connect your PostgreSQL database to Contextflo with a dedicated read-only user. Works with any hosted Postgres: AWS RDS, Supabase, Neon, Google Cloud SQL, Azure Postgres, Railway, Render, or self-hosted.

Prerequisites

  • Admin access to your PostgreSQL database
  • The host, port, and database name you want to connect
  • Network access from Contextflo to your database (add Contextflo's IPs to your allowlist if needed)

Step 1: Create a read-only user

Run this as an admin in psql or your SQL client. Update the password and database name before running.

Loading code sample...

The ALTER DEFAULT PRIVILEGES line is what stops new tables from being invisible next month. Default privileges are scoped to the role that creates the objects, so if your migrations or ETL run as a different user, run that line for that user too (... FOR ROLE dbt_user ...), or the tables it creates later won't be visible.

Repeat the GRANT USAGE and GRANT SELECT lines for any additional schemas you want to expose.

Step 2: Point at a read replica (recommended)

If you have a read replica, connect Contextflo to it rather than your primary. An exploratory aggregation over a few million rows is a reasonable question and a capable way to load your primary. RDS, Supabase, Neon and most hosted providers give you a replica endpoint.

Connection Details for Contextflo

In Contextflo, add a PostgreSQL connection under Data Sources and provide:

  • Connection Name: A friendly name (e.g., "Production Postgres")
  • Host: Your database host (e.g., db.example.com)
  • Port: 5432 (default)
  • Database: Your database name
  • Username: contextflo_readonly
  • Password: The password you set in the script
  • SSL: Enable if your provider requires it

You can also paste a full connection string (postgresql://user:pass@host:5432/db?sslmode=require) instead of the individual fields.

Click Test Connection, then save. Contextflo fetches your schema so you can pick which tables to sync.

Verify Permissions

Confirm the user can read the tables you expect:

Loading code sample...

Security Notes

  • Read-only access: This setup only grants SELECT permissions. Contextflo cannot modify or delete your data.
  • Encrypted storage: Your credentials are encrypted at rest.
  • Strong password: Use a long, randomly generated password.

Troubleshooting

Connection timeout

  • Check that your firewall or security group allows connections from Contextflo's IPs
  • Verify the host and port
  • Confirm the database accepts remote connections

Authentication failed

  • Double-check the username and password
  • Enable SSL if your provider requires it

Tables not showing

  • Confirm the user has USAGE on the schema and SELECT on its tables
  • If new tables are missing, apply the ALTER DEFAULT PRIVILEGES line for the role that creates them

Next Steps