How to connect Postgres to an AI data analyst
Updated 2026-07-01
An AI data analyst is most useful when it runs on your real database instead of a file you paste in. This guide shows how to connect a PostgreSQL database so you can ask questions in plain English and get charts, dashboards and reports back — without writing SQL by hand.
The whole setup takes a few minutes. You connect with a read-only user, let the AI read your schema, and ask your first question. Your database credentials are encrypted, and the analysis runs on your own AI provider key.
- 1
Gather your PostgreSQL connection details
You need the host, port (usually 5432), database name, username and password. If your database is hosted (for example on a managed Postgres provider), copy the connection string from its dashboard. For anything internet-facing, keep SSL enabled.
- 2
Create a read-only database user (recommended)
Give the AI analyst its own user with SELECT-only access. This means it can read data to answer questions but can never modify it. A read-only role is the safest way to connect any production database to an analytics tool.
- 3
Create your account and add your AI key
Sign up, then add your own AI provider key (bring-your-own-key). If you don't have one yet, a free key takes about a minute to create. Your key is encrypted and used only for your requests, so you stay in control of cost and privacy.
- 4
Add the PostgreSQL connection
In the app, add a new data source, choose PostgreSQL, and paste your host, port, database, user and password (or the full connection string). Enable SSL if your provider requires it, then test and save. Credentials are encrypted at rest.
- 5
Let the AI read and annotate your schema
The analyst reads your tables and columns and describes what they mean. If you use dbt, point it at your models so it recognises your fact and dimension tables. This is the semantic layer — and it keeps improving as you use it.
- 6
Ask your first question in plain English
Ask something like "revenue by month this year" or "top 10 customers by orders". On complex questions the analyst shows a readable query plan before it runs anything; review it, then get a chart plus the data behind it. Refine by chatting, then pin it to a dashboard or save it as a report.
Why connect the database instead of exporting a file
Exports go stale the moment you download them, and a general AI assistant that only sees a pasted file has to guess what your columns mean. A connected AI data analyst reads live data, shows the query plan in business terms before running it, and remembers what your fields mean between sessions — so answers stay current and consistent.
Keeping it safe
- Connect with a read-only user so the analyst can never change your data.
- A read-only SQL guard blocks anything that isn't a SELECT.
- Connection details and your AI key are encrypted at rest.
- Your business data isn't stored or used to train any model.
Frequently asked questions
Related
Get your end-to-end AI business intelligence now.
Conversational analytics with AI that understands your data — no SQL, no data team required.