Skip to content

PostgreSQL

DataLoris needs to connect, see your schemas and run SELECT aggregates. Give it its own user so you can audit and revoke it independently.

Run as a database owner or superuser, once per database. Repeat the schema lines for every schema you want to monitor.

CREATE ROLE dataloris_ro LOGIN PASSWORD 'choose-a-strong-password';
ALTER ROLE dataloris_ro SET default_transaction_read_only = on;
GRANT CONNECT ON DATABASE shop TO dataloris_ro;
GRANT USAGE ON SCHEMA public TO dataloris_ro;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO dataloris_ro;
-- Tables created later by the role running this statement:
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO dataloris_ro;

ALTER DEFAULT PRIVILEGES only covers tables created by the role that runs it. If your pipelines create tables as another role, add FOR ROLE etl_user to it.

Besides your tables, DataLoris reads the standard catalogs (information_schema.columns, pg_class, pg_index, pg_stats and pg_stat_all_tables), which every user can read for tables it has access to. No extra grant is needed.

  1. Open Connections and click Add connection, then choose PostgreSQL.

  2. Fill in the fields:

    Field Notes
    Host Public hostname or IP of the server. localhost, internal names and private IPs are refused.
    Port Defaults to 5432.
    Database The database to connect to. One connection covers one database.
    User / Password The read-only user from step 1.
    SSL mode disable, allow, prefer, require (default), verify-ca or verify-full. Keep require or stricter.
  3. Save. The connection is tested automatically and turns ACTIVE when DataLoris can log in.

In a suite, click Add asset, choose PostgreSQL table, select the connection and enter the table as schema.table (for example analytics.orders_daily). See assets.

PostgreSQL does not record when a table was last written, so the table freshness rule watches the table’s write counters (pg_stat_all_tables) instead:

  • the first run only records a baseline;
  • a change is noticed at the next run, so the precision equals the suite’s schedule;
  • it must run against the primary server. Write counters are not replicated, so on a read replica the rule ends in error.

If your connection points at a replica, use column freshness on an updated_at or created_at column instead.

Error Fix
The host must be a public address Use the server’s public hostname or IP. Tunnels to private networks are not supported.
destination not allowed The hostname resolves to a private address. Use a public endpoint.
password authentication failed Check the user and password, and that pg_hba.conf allows the user over the network.
no pg_hba.conf entry … SSL off The server requires SSL: set SSL mode to require.
permission denied for table Grant SELECT on the table (step 1), then run the suite again.
timeout The server is not reachable from the internet, or a firewall blocks DataLoris.