FluentDBFluentDB

Chat with your database: how it works, and when to trust it

By Kevin Piacentini, Software Engineer & Founder of FluentDB·

"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:

The four steps between your question and an answer
StepWhat happensWhere it goes wrong
1. ReadThe tool reads your schema: tables, columns, types, keysMissing context on what a column means
2. WriteThe model turns your question into SQLWrong table, wrong join, wrong definition
3. RunThe query executes against your databaseSlow query, or a write if the connection allows it
4. ShowYou get rows backA 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:

sql
-- 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 habit worth building: before you use a number, read the query and ask two questions. Does this count the thing I meant? And is the magnitude plausible? If last month had 4,000 signups and this says 40, the join dropped something. You do not need to write SQL to catch either of these.

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.

sql
-- 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.

Ask your database, on your Mac

FluentDB connects to PostgreSQL, MySQL, SQL Server and SQLite, reads your schema, and writes the SQL when you ask in plain English. It shows you the query before it runs, and the assistant sees your schema rather than your rows.

Download FluentDB for Mac

Chatting with a database, FAQ

Can I really query a database without knowing SQL?

For most everyday questions, yes. An AI assistant reads your table and column names and writes the SQL for you. What it cannot do is know what your business means by a word like 'active' or 'churned', so the answer is only as good as your ability to sanity-check it. Reading SQL is far easier than writing it, which is the skill actually worth having.

Is it safe to let AI run queries on my database?

It depends entirely on two things: whether the connection is read-only, and whether you see the query before it runs. A read-only connection cannot modify or delete anything regardless of what the AI writes. Seeing the query first is what stops a wrong answer becoming a wrong decision. Insist on both.

Does the AI see my actual data?

In FluentDB, by default it sees your schema, meaning table and column names and types, not your rows. That is usually enough to write correct SQL. Other tools vary a lot on this, and it is the first question to ask of any of them.

What is the most common way this goes wrong?

Not a crash, and not an error. The dangerous failure is a query that runs perfectly and returns a plausible but wrong number, usually because it joined the wrong table, silently dropped rows with an inner join, or counted a different thing than you meant. You catch it by reading the query and sanity-checking the magnitude, not by trusting the output.

Do I need my company's permission to connect?

You need a connection string and credentials, which usually means asking whoever runs the database. Ask for a read-only user pointed at a replica if one exists. That request is much easier to approve than full access, and it is the right level for asking questions anyway.

Is this different from pasting my schema into ChatGPT?

Mostly in the loop. ChatGPT can write SQL from a pasted schema perfectly well, but you then copy the query somewhere else to run it, copy the error back, and repeat. A database client with the assistant built in reads the schema itself and runs the result in place, so the cycle is one step instead of four.