Chat with your database: how it works, and when to trust it
"Just ask your database a question" is no longer marketing. An assistant that can read your schema writes usable SQL for most everyday questions, and it genuinely removes the wait for someone else to have time.
What almost nobody tells you is the failure mode. It is not a crash and it is not an error message. It is a query that runs perfectly and hands back a number that is confidently wrong. This page is about how the thing works, and how to catch that.
What actually happens when you ask
There is no magic, and knowing the four steps tells you where it can go wrong:
| Step | What happens | Where it goes wrong |
|---|---|---|
| 1. Read | The tool reads your schema: tables, columns, types, keys | Missing context on what a column means |
| 2. Write | The model turns your question into SQL | Wrong table, wrong join, wrong definition |
| 3. Run | The query executes against your database | Slow query, or a write if the connection allows it |
| 4. Show | You get rows back | A plausible number nobody checks |
Step 2 is where the interesting mistakes live, and step 4 is where they survive.
The failure that matters
A broken query is harmless. It errors, you notice, you fix it. The expensive failure is the one that works.
Three that come up constantly:
-- You asked: "how many customers signed up last month?"
-- The wrong-join version: drops every customer with no orders,
-- because an inner join quietly filters
SELECT COUNT(*) FROM customers c
JOIN orders o ON o.customer_id = c.id
WHERE c.created_at >= '2026-07-01';
-- The wrong-definition version: counts rows, not people,
-- so one customer with three signups counts three times
SELECT COUNT(*) FROM signups WHERE created_at >= '2026-07-01';
-- The right one, probably
SELECT COUNT(DISTINCT c.id) FROM customers c
WHERE c.created_at >= '2026-07-01'
AND c.created_at < '2026-08-01';All three run. All three return a number. Two of them are wrong, and nothing about the output says so. If that number goes into a board deck, the tool did not fail, the process did.
The three things to insist on
Whatever tool you use, these matter more than how good the model is.
1. You see the query before it runs. This is the whole safety mechanism. A tool that shows you an answer without the SQL is asking you to trust a black box with a number you will repeat in a meeting.
2. The connection is read-only. Then the worst case is a wrong answer rather than a wrong answer plus modified data. Worth being precise: how strongly this can be enforced depends on the database. In FluentDB it is enforced hard on PostgreSQL and SQLite, via a session flag on MySQL, and is advisory on SQL Server. Ask any vendor this question and be suspicious of a simple yes.
3. Know what leaves your machine. Some tools send rows to a model to answer a question. That may be fine for a test database and is not fine for customer records. FluentDB sends your schema by default, not your rows, and you bring your own API key or run a model locally with Ollama.
Getting access without annoying anyone
If you do not already have a connection string, the ask is smaller than you think, and how you phrase it decides the answer.
Do not ask for "database access". Ask for a read-only user, on the replica if there is one. That is a request a sensible engineer can approve in minutes, because it cannot break anything and does not add load to production. It is also exactly the right level of access for asking questions.
-- What you are asking for, in Postgres terms
CREATE USER analytics_readonly WITH PASSWORD 'generated-by-them';
GRANT CONNECT ON DATABASE app TO analytics_readonly;
GRANT USAGE ON SCHEMA public TO analytics_readonly;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO analytics_readonly;Sending that with the request tends to speed things up considerably, because it shows you have thought about the blast radius.
When you should not do this
Being straight about the limits, because they are real.
When the answer must be exactly right and repeatable. Revenue reporting, anything regulated, anything a customer sees. Those belong in a defined, reviewed query that somebody owns, not a fresh question each time.
When the question is really about business logic.If nobody in the company agrees what "active user" means, no assistant resolves that. It will pick one interpretation, silently.
When you need to share the result on a schedule. A desktop client answers your question on your machine. If ten people need the same number every Monday, that is a dashboard.
Where it genuinely shines is the middle ground: the ad-hoc question you would otherwise put in someone's Slack and wait a day for. How this compares with AI data analyst tools is written up separately, including when a spreadsheet tool is the better fit.