Skip to content

PostgreSQL

Connect Querri to your PostgreSQL database, choose the tables to load, and ask questions about them in plain language.

The PostgreSQL connector copies the tables you choose into Querri, where you can ask about them, build views and track KPIs. It connects by host and credentials, and can reach private databases through an OpenVPN tunnel.

  • A PostgreSQL server Querri can reach
  • A database user, ideally read-only (see Database user setup)

If your database only accepts connections from known addresses, allow Querri’s outbound IP address in your firewall or security group. For a database reachable only over a private network, use Connect via VPN (Advanced) in the form.

  1. Open the connector. Click Connect in the app rail and pick PostgreSQL under Connect a data source. Admins can also click Connect on PostgreSQL in Settings → Connectors.

  2. Enter connection settings under Connection Settings:

    FieldDefault
    Connector NamePostgreSQL
    Host *
    Port5432
    Username *
    Password
    DatabaseOptional; leave blank to discover from the server
    Require SSL ConnectionOn
    Connect via VPN (Advanced)Off
  3. Test the connection. Click Test connection and discover access. This creates the connector, then tests it and lists the databases and schemas the user can read: “Connected! Found {n} databases and {m} schemas”.

  4. Select data. Under Select Data, pick a database and schema (the schema defaults to public). All Tables is on by default; turn it off to choose tables, views, materialized views or foreign tables. Add Custom SQL Queries to load a query’s result as its own source.

  5. Check advanced settings. Limit rows per table is off, so every row loads. Data Sync Enabled stays off until you load data.

  6. Load your data. Click Save and Load Data. A progress card shows each table loading. When it’s done, click View in Library, or Sync daily to set up a daily full refresh.

Create a dedicated read-only user for Querri:

-- Create user
CREATE USER querri_readonly WITH PASSWORD 'secure_password_here';
-- Grant connect permission
GRANT CONNECT ON DATABASE your_database TO querri_readonly;
-- Grant schema usage
GRANT USAGE ON SCHEMA public TO querri_readonly;
-- Grant select on all tables
GRANT SELECT ON ALL TABLES IN SCHEMA public TO querri_readonly;
-- Grant select on future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public
GRANT SELECT ON TABLES TO querri_readonly;

For tighter control, grant access only to specific tables or to an analytics schema:

-- Grant access to specific tables only
GRANT SELECT ON orders, customers, products TO querri_readonly;
-- Or grant access only to an analytics schema
GRANT USAGE ON SCHEMA analytics TO querri_readonly;
GRANT SELECT ON ALL TABLES IN SCHEMA analytics TO querri_readonly;

See Database Best Practices for analytics views and access.

The connector’s owner can keep PostgreSQL data up to date on the Schedule tab.

Reloads every table. Use it as a regular baseline, and to pick up rows deleted in PostgreSQL.

Fetches only rows changed since the last sync, using a cursor column. Enter it in Cursor Field, or leave it blank for Querri to detect one. Tables without that column are skipped by the incremental schedule.

ColumnBest for
updated_atTables that record when a row changes. Catches new and updated rows
created_atAppend-only tables. Only catches new rows
Sequential idAppend-only tables. Only catches new rows

Use Full Refresh for tables without a reliable cursor column, lookup tables, and tables that are truncated and reloaded.

ScheduleRepeat
IncrementalEvery Hour
Full RefreshEvery Day

On the full schedule, turn on Skip sources with active incremental sync so tables already covered by the incremental schedule aren’t reloaded.

Scheduled syncs use credits when they run. See the Sync Scheduling guide.

  1. Check that your firewall or security group allows Querri’s address, or that the VPN files are loaded.
  2. Check the host and port.
  3. Check that the database is running and accepts remote connections.
  4. Check that Require SSL Connection matches the server. If the server doesn’t support SSL, turn it off.
  1. Double-check the username and password.
  2. Check the user exists: SELECT * FROM pg_user WHERE usename = 'your_username';
  3. Check the user has CONNECT permission on the database.
  1. Grant the permissions under Database user setup.
  2. Check the schema name.
  3. Run \dp table_name to see a table’s permissions.
  1. If the server requires SSL, keep Require SSL Connection on.
  2. If the server doesn’t support SSL, turn the switch off. Only do this on a private network.
  3. Check the server’s SSL certificate and configuration.
  • Use read-only credentials. It prevents accidental changes and makes access easy to audit.

  • Keep SSL on for production databases.

  • Grant only what’s needed:

    -- Only SELECT on specific tables
    GRANT SELECT ON TABLE orders, customers TO querri_readonly;
    -- Only specific columns (if needed)
    GRANT SELECT (customer_id, email, created_at) ON customers TO querri_readonly;
  • Monitor access:

    SELECT * FROM pg_stat_activity
    WHERE usename = 'querri_readonly';