Skip to content

Connect a Warehouse

~3 minutes · ends with dql doctor confirming the configured connection

DQL ships 15 drivers out of the box. Connections live in dql.config.json at the project root. Keep secrets in environment variables and reference them with ${ENV_VAR} interpolation.

1. Pick your connector

{
  "connections": {
    "default": {
      "driver": "postgres",
      "host": "${PGHOST}",
      "port": 5432,
      "database": "analytics",
      "user": "${PGUSER}",
      "password": "${PGPASSWORD}",
      "schema": "public"
    }
  }
}

Per-driver options live in the Connector reference.

2. Export credentials

export PGHOST=prod-db.internal
export PGUSER=analyst_ro
export PGPASSWORD=...

3. Verify

dql doctor
# Local query runtime
# driver=postgres is available

If that passes, the notebook and CLI resolve table references against this connection.

Multiple connections

{
  "connections": {
    "default": { "driver": "duckdb", "path": "./warehouse.duckdb" },
    "prod": { "driver": "snowflake", "account": "${SNOWFLAKE_ACCOUNT}" },
    "raw": { "driver": "postgres", "host": "${RAW_PGHOST}" }
  }
}

Reference a non-default connection from a cell:

-- @connection: prod
select count(*) from analytics.orders

Troubleshooting

  • connection refused — firewall, VPN, wrong host, or wrong port. Run dql doctor after checking the resolved environment variables.
  • role does not have USAGE on schema — warehouse permissions. DQL needs USAGE on the schema and SELECT on queried objects.
  • BigQuery service account — set GOOGLE_APPLICATION_CREDENTIALS to the key file path; the driver auto-picks it up.