Talk to Database, in Ask AI
Talk to your database. The AI never sees a row.
Ask a managed PostgreSQL database a question in your own words and get a sentence, a chart, a table and the SQL. The AI only picks names from a file you approved. Our code writes the SQL and runs it read-only. The rows go to your browser, never to the AI.
What comes back
Ask a question.
Get the answer and the SQL behind it.
A sentence, a chart, a table and the statement that produced them, in the same assistant you use for everything else in the console. Follow up in a few words and it refines the last answer. When your file cannot answer, it says what to add.
Ask orders-db about its data. Try one:
Revenue by month this year (2026), from Orders.
Highest: August 2026, $12,400. Lowest: January 2026, $3,150.
| time | revenue |
|---|---|
| 2026-01-01 | 3,150.00 |
| 2026-02-01 | 4,820.00 |
| 2026-03-01 | 5,400.00 |
| 2026-04-01 | 6,110.00 |
SELECT date_trunc('month', (t."created_at" AT TIME ZONE 'UTC')) AS "time", (SUM(amount) FILTER (WHERE status = 'paid') / 100.0) AS "revenue" FROM "public"."orders" AS t WHERE (t."created_at" AT TIME ZONE 'UTC') >= '2026-01-01 00:00:00' AND (t."created_at" AT TIME ZONE 'UTC') < '2027-01-01 00:00:00' GROUP BY 1 ORDER BY "time" ASC The statement the read-only account ran. It carries the values in your question.
Ran today at 14:03 on orders-db
Who wrote what
- 1 The sentence Written by our code from the pick and your file’s display names. The one-line highlight under it is worked out from the rows. No model writes a word of a data answer.
- 2 The chart A time grain draws a line. One breakdown draws bars.
- 3 The table Up to 200 rows, ready to copy as CSV.
- 4 The SQL How I got this shows the exact statement the read-only account ran, with the values from your question in it.
- 5 Follow-ups “now by week” or “only refunded” changes the last pick instead of starting again.
How your data stays yours
The AI reads your file.
Your rows never reach it.
Talk to Database splits the job in two. A model works out what you mean, using only the names in a file you approved. Everything that touches your data is our code and your own database.
How a Talk to Database question travels: only your question and the names in your approved file reach the AI model; rows, results and SQL never do.
- 1You ask a managed PostgreSQL database a question in the console's assistant.
- 2Our backend sends an AI model your question and the names, descriptions and instructions in the file you approved. Nothing else from your account goes with them.
- 3The model answers with a pick: which view, measures, dimensions, filters and time range. Our code checks every name against your file.
- 4Our code writes the SQL and runs it as a read-only account that can read only the tables and columns your file lists, in a read-only transaction that stops after 15 seconds.
- 5The rows come back encrypted and wait on our servers only until your browser collects them, 15 minutes at most. Your browser draws the chart and the table. The rows never go to the model.
Written down, not implied
What the AI sees,
and what it never sees.
The model sees
- Your question, as you typed it
- The names, descriptions and value labels in the file you approved
- The instructions you wrote in the file, such as what “revenue” means
- Today’s date in your file’s time zone
- The last pick, when you follow up
The model never sees
- Rows, results or the chart
- The SQL our code writes
- The SQL expressions in your file
- Columns on your file’s hidden list
- Tables and columns your file does not list
- Your other databases, your projects or anything else in your account
Set it up once per database
Three steps,
and you decide what it can read.
The file is the whole fence: the model reads only what it names. The read-only account can read only what it lists. Set it up from the database’s Configuration tab or from the assistant itself.
- 1 Get a starter file We read the database’s table and column names and types (never a row) and write a file that describes them. No AI writes it. Columns whose names look like secrets, such as password_hash or api_key, go on its hidden list.
- 2 Make it yours Name the measures you ask about (revenue, active users) and say what they mean. By hand or with the prompt the console gives you in any AI chat you already use; your table and column names go to that chat.
- 3 Upload and approve We check the file against the database line by line and set up a read-only account that can read only the tables and columns it lists. Each approval is saved as a new version. You can download the file at any time.
version: 1
database: shop
timezone: UTC
ai_instructions: |
Money is stored in cents. "Revenue" means paid orders only.
views:
- name: orders
display_name: Orders
description: One row per checkout.
table: public.orders
timeseries: created_at
dimensions:
- { name: status, column: status, values: { paid: Paid, refunded: Refunded } }
- { name: country, column: shipping_country }
measures:
- name: revenue
display_name: Revenue
expression: SUM(amount) FILTER (WHERE status = 'paid') / 100.0
format: currency_usd
hidden:
- public.customers.email
- public.users.password_hash A Talk to Database file. The format follows Rill’s metrics views, so it can live in your repository beside your schema.
The design
Why the AI does not
write the SQL.
A model that writes queries is one wall between a question and your data. Talk to Database puts two walls there. Neither of them is a model.
The usual text-to-SQL design
- The model writes the query, so the query is only as safe and as right as the model.
- The query can read whatever the connection can read.
- Staying read-only depends on how that connection was set up.
- To write a summary, the rows go back to a model.
Talk to Database
- The model returns a pick of names. Our code checks every one against your file and writes the SQL, quoting every name and value.
- The account that runs it can read only the tables and columns your file lists.
- That account is read-only. Every question also runs inside a read-only transaction.
- The sentence is written by our code, so rows never go back to a model.
Your measures stay yours too: their SQL lives in your file, where you wrote it. The model only ever reads their names and descriptions.
The limits, written down
Six things to know
before you ask.
Nobody likes finding a limit by hitting it, so here they are up front. What we keep from your questions and for how long is in our privacy policy.
- 1 Managed PostgreSQL only, on a running database. Not MySQL, not ClickHouse and not a database inside a project.
- 2 Owners and admins ask. Other members see whether it is set up. Selfhost.dev staff cannot ask your database anything.
- 3 30 questions every 10 minutes per person, 300 a day per organisation and one question at a time per database.
- 4 Up to 200 rows per answer. Each statement stops after 15 seconds, so narrow the question to see the rest.
- 5 It answers totals, trends by hour, day, week, month, quarter or year, comparisons with the period before, shares of a total, filters and lists. Not yet: cohorts, funnels, running totals or the top N in each group.
- 6 Your question and the names in your file go to a third-party AI model. Rows and SQL never do.
Frequently asked questions
Does the AI see my data?
Does the AI write the SQL?
Can Talk to Database change my data?
Which databases does it work on?
Who can use it?
What happens when my schema changes?
What if it cannot answer a question?
Where are my questions and answers kept?
Does it cost extra?
Can I turn it off?
Ask your database.
Keep your rows.
$5 in free credit, no card needed. Then open Talk to Database on its Configuration tab.