Datasource setup

Connect PostgreSQL

Prepare a PostgreSQL login, connect it in Querio, and verify a query against an approved table.

Choose a small approved table with a result you can verify before you start.

Before you start

  • You need permission to manage datasource credentials in your Querio workspace. See Datasources and credentials.
  • Ask your database administrator for the host, port, database, schema, TLS requirements and permission to create a login and grant access.
  • Confirm that Querio can reach the database. A connection from your laptop does not establish that Querio can reach it. For a database behind a bastion, follow Connect through an SSH tunnel.

1. Create a read-only login

As an authorized PostgreSQL administrator, create a login for Querio:

CREATE ROLE querio_reader LOGIN;

Set its password through your approved credential-management process. In an administrator's psql session, \password querio_reader prompts for it without putting it in SQL. See PostgreSQL's CREATE ROLE and psql password command documentation.

Use a non-owner login without superuser privileges or broader role memberships. Keep its password and complete connection URL out of prompts, source control, screenshots and support messages.

2. Grant read-only access

Connect to the target database as an owner or administrator authorized to grant access. Replace analytics and reporting with your database and schema names:

GRANT CONNECT ON DATABASE analytics TO querio_reader;
GRANT USAGE ON SCHEMA reporting TO querio_reader;
GRANT SELECT ON ALL TABLES IN SCHEMA reporting TO querio_reader;

These grant database connection, schema access and reads on existing tables separately. To allow only selected tables, replace the last statement with grants such as GRANT SELECT ON TABLE reporting.orders TO querio_reader;. Repeat for each approved schema or table. See PostgreSQL's GRANT reference.

If the login also needs to read future tables, have the owner configure default privileges for the role that creates them. For example, when app_owner creates tables:

ALTER DEFAULT PRIVILEGES FOR ROLE app_owner IN SCHEMA reporting
GRANT SELECT ON TABLES TO querio_reader;

This applies only to future tables created by app_owner in reporting. It does not grant access to existing tables or tables created by another role. See PostgreSQL's default-privilege rules.

The grants add read access; they do not remove permissions inherited through other roles or PUBLIC. Have the administrator review effective permissions. Row security policies may also limit the rows returned.

3. Enter the connection in Querio

Open Settings > Datasources > Add datasource, choose Internal, and enter:

FieldValue
SlugA unique identifier such as postgres-analytics.
NameAn optional display name, such as Analytics database.
Database typePostgreSQL.
Connection stringThe URL with the login, password, host, port, database and required TLS options.
SchemaAn optional single schema name, such as reporting.

Use your actual values in this synthetic URL:

postgresql://querio_reader:REPLACE_PASSWORD@db.example.com:5432/analytics?sslmode=verify-full

Use the administrator's port; 5432 is common, not guaranteed. Percent-encode reserved characters within URL values, such as @ in a password as %40, following PostgreSQL's connection URI rules. Credentials containing spaces currently have a URL-normalization limitation in Querio; ask Querio to resolve compatibility before using them.

An explicit Schema sets the session search path to that one schema. It does not grant access or prevent queries against other permitted schemas. Leave it unset to keep the database and role search path; do not assume that path is public.

Network and TLS

The host and port must accept connections from Querio's execution environment. If your database restricts incoming connections, use Copy IP Address in the connection form and have your administrator allow the approved source. For self-managed PostgreSQL, check its listening interface and the matching database, user and network rule in pg_hba.conf.

Put TLS options in the URL. This form has no separate SSL switch or CA/certificate upload. In the example, sslmode=verify-full requires a trusted CA in Querio's execution environment and a certificate that matches the hostname. sslmode=require encrypts the connection but does not provide the same hostname verification. See PostgreSQL's TLS verification rules.

Certificate paths in URL options refer to Querio's execution environment, not your laptop. If your server needs private CA or client certificate files, confirm their deployment setup with Querio before connecting.

4. Test and save

  1. Select Test connection. Connection successful means Querio connected with the supplied URL; it does not save the datasource.
  2. Select Create. Querio tests again before saving and prevents creation if the test fails.
  3. Confirm the datasource appears in Settings > Datasources.

The test runs SELECT 1, which does not read your table. Before teammates query, review the credential assignment: the first credential is initially assigned to Everyone. Each person also needs datasource permission and exactly one authorized credential. See credential selection.

5. Add tables and verify a query

  1. In Context, select the datasource and choose Add tables. Select the approved schemas or tables, confirm Add, and check that the expected columns appear. Review any introspection failures.
  2. As the intended user, open an Explore with this datasource selected. Run this synthetic SQL, or ask Querio to run it exactly:
SELECT 6 * 7 AS answer;

Expected: one row with answer = 42. This checks query execution and result retrieval, but not access to a business table.

  1. Query an approved table. Replace the schema, table, columns and filter with a record whose result you know:
SELECT order_id, order_total
FROM reporting.orders
WHERE order_id = 'known-test-order';

Compare that result with the same query run as querio_reader in a trusted database client. If rows are missing or values differ, resolve the discrepancy before building on the analysis.

Troubleshooting

SymptomWhat to check
Timeout, refusal or hostname failureCheck the endpoint, port, listening interface and permitted source network from Querio. Your laptop's connection is a separate test.
Authentication or pg_hba.conf failureConfirm the database, login, password and matching server access rule. Check URL encoding and the credential-space limitation above; do not send the URL in a support message.
TLS verification failsCheck the hostname, certificate chain and trust configuration in Querio's execution environment. Arrange required files with Querio.
Permission denied for schema or tableCheck CONNECT, USAGE and SELECT on the actual object for this login.
Existing tables work but new ones failCheck default privileges for the actual creating role, then grant access to already-created tables separately.
Relation missing or rows differCheck the database, schema-qualified name, filters and row security under the same login.
One Querio user can query, another cannotReview datasource permission and credential assignments in Groups.

Continue with Analyze your data, then Add and improve context for the table definitions and relationships your team uses.

Was this page helpful?

Last updated on December 3, 2026

On this page