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
- PostgreSQL: supported today (the driver ships with the hosted service and the on-prem image).
- MySQL, SQL Server: on request — their drivers are not shipped yet.
- SQLite and DuckDB files: refused by design (a file path is not a network database). Upload the data instead.
- Files: CSV, Excel and Parquet can be uploaded directly (see Getting started).
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
- On-prem: both run in your network; allow the ProLyt server in the database's firewall (port 5432 by default).
- Hosted service: the database must be reachable from the internet and the connection uses TLS (ProLyt adds
sslmode=require). Private addresses —localhost, LAN ranges, VPN names — are refused with a message saying this needs an on-premise installation. If your policy requires allow-listing the connecting address, ask us for it; we do not yet guarantee it stays fixed, which is one more reason most companies with an internal database choose on-prem.
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
- Table and column names, plus one sample row per table, to find the right tables for a question.
- The rows its own queries return (at most 50 rows and about 6,000 characters per result are shown to the model) to write the answer.
- Nothing else. Queries run live; it does not copy whole tables.