Skip to main content

PostgreSQL

Connect a Postgres database as a datasource, then write SQL queries (with prepared statements recommended for user input).

Connect

  1. Datasources → New → PostgreSQL
  2. Enter host, port, database, username, and password for the target environment.
  3. Test the connection, then Save.

Use separate configurations for staging and production when your workspace uses environments.

Query

Create a query on the datasource. Prefer prepared statements for dynamic values — see Prepared statements.

Bind results with {{QueryName.data}} on Tables and other widgets.