ProLyt

Docs › Connecting a database

Connecting a database

ProLyt reads from your database and never writes to it. Two layers make sure of that: ProLyt refuses any statement that writes, and the database user you create has read permission only. The second layer is the one to rely on — ProLyt's guard covers write statements, not every read-only function a database may expose.

Supported databases

1. Create a read-only user (PostgreSQL)

Run as a database administrator, replacing the names:

`` CREATE ROLE prolyt_reader LOGIN PASSWORD 'choose-a-long-password'; GRANT CONNECT ON DATABASE sales TO prolyt_reader; GRANT USAGE ON SCHEMA public TO prolyt_reader; GRANT SELECT ON ALL TABLES IN SCHEMA public TO prolyt_reader; ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO prolyt_reader; ``

To expose only some tables, grant SELECT on those tables instead of ALL TABLES. What the user cannot read, ProLyt cannot read.

2. Make the database reachable

3. Add the connection in ProLyt

A workspace owner adds it on the Workspace page under Data & sources → Connected database (one database per workspace). Enter the connection string:

`` postgresql://prolyt_reader:<password>@db.example.com:5432/sales ``

ProLyt tests the connection before saving — a wrong password, an unreachable host or a missing database is refused with the reason and nothing is stored. The password is stored encrypted and is never shown again; ProLyt then reads the table and column names and shows the tables in the data panel. On on-prem installs the operator can also set the database at workspace creation (create_tenant.sh … database <url>).

4. Check it

Ask a simple question you know the answer to, e.g. "How many rows does the orders table have?", and compare it with your own query. Every answer shows the SQL it ran and the tables it read.

What ProLyt reads