PostgreSQL
Connect Querri to your PostgreSQL database, choose the tables to load, and ask questions about them in plain language.
Overview
Section titled “Overview”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.
Prerequisites
Section titled “Prerequisites”- A PostgreSQL server Querri can reach
- A database user, ideally read-only (see Database user setup)
Network access
Section titled “Network access”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.
Creating the connector
Section titled “Creating the connector”-
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.
-
Enter connection settings under Connection Settings:
Field Default Connector Name PostgreSQL Host * Port 5432 Username * Password Database Optional; leave blank to discover from the server Require SSL Connection On Connect via VPN (Advanced) Off -
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”.
-
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. -
Check advanced settings. Limit rows per table is off, so every row loads. Data Sync Enabled stays off until you load data.
-
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.
Database user setup
Section titled “Database user setup”Read-only user (recommended)
Section titled “Read-only user (recommended)”Create a dedicated read-only user for Querri:
-- Create userCREATE USER querri_readonly WITH PASSWORD 'secure_password_here';
-- Grant connect permissionGRANT CONNECT ON DATABASE your_database TO querri_readonly;
-- Grant schema usageGRANT USAGE ON SCHEMA public TO querri_readonly;
-- Grant select on all tablesGRANT SELECT ON ALL TABLES IN SCHEMA public TO querri_readonly;
-- Grant select on future tablesALTER DEFAULT PRIVILEGES IN SCHEMA publicGRANT SELECT ON TABLES TO querri_readonly;Restricting access to specific tables
Section titled “Restricting access to specific tables”For tighter control, grant access only to specific tables or to an analytics schema:
-- Grant access to specific tables onlyGRANT SELECT ON orders, customers, products TO querri_readonly;
-- Or grant access only to an analytics schemaGRANT 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.
Sync scheduling
Section titled “Sync scheduling”The connector’s owner can keep PostgreSQL data up to date on the Schedule tab.
Full Refresh
Section titled “Full Refresh”Reloads every table. Use it as a regular baseline, and to pick up rows deleted in PostgreSQL.
Incremental
Section titled “Incremental”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.
| Column | Best for |
|---|---|
updated_at | Tables that record when a row changes. Catches new and updated rows |
created_at | Append-only tables. Only catches new rows |
Sequential id | Append-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.
Suggested setup
Section titled “Suggested setup”| Schedule | Repeat |
|---|---|
| Incremental | Every Hour |
| Full Refresh | Every 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.
Troubleshooting
Section titled “Troubleshooting”Connection timeout
Section titled “Connection timeout”- Check that your firewall or security group allows Querri’s address, or that the VPN files are loaded.
- Check the host and port.
- Check that the database is running and accepts remote connections.
- Check that Require SSL Connection matches the server. If the server doesn’t support SSL, turn it off.
Authentication failed
Section titled “Authentication failed”- Double-check the username and password.
- Check the user exists:
SELECT * FROM pg_user WHERE usename = 'your_username'; - Check the user has CONNECT permission on the database.
Permission denied
Section titled “Permission denied”- Grant the permissions under Database user setup.
- Check the schema name.
- Run
\dp table_nameto see a table’s permissions.
SSL connection error
Section titled “SSL connection error”- If the server requires SSL, keep Require SSL Connection on.
- If the server doesn’t support SSL, turn the switch off. Only do this on a private network.
- Check the server’s SSL certificate and configuration.
Security best practices
Section titled “Security best practices”-
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 tablesGRANT 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_activityWHERE usename = 'querri_readonly';
Next Steps
Section titled “Next Steps”- Database Best Practices: analytics views and access
- Connecting Databases: the shared database form in detail
- Managing Connections: change and refresh your connectors