← AI agents and your data

How can I ask my database questions in plain English?

Updated · DBShifts

Short answer

Use a natural-language tool that answers from your real rows without letting the model loose on the database. The safe pattern is that the model calls governed, read-only tools — filter, aggregate, follow a foreign key — instead of generating SQL, sensitive columns stay masked, and every question is logged.

Key facts

  • Natural-language querying does not require the model to write SQL.
  • The rows needed to answer a question are sent to the AI provider that answers it, so masking must happen first.
  • Joins should follow real foreign keys, or the model can invent relationships that don't exist.
  • Showing the lookup steps behind an answer lets people check it.
  • Spending limits matter: every question costs model tokens.

How it works safely

The model gets a set of tools — list the tables, filter one, aggregate it, follow a foreign key — and decides which to call. The tools run on your side, read-only and through the same masking and access rules a person browsing would get. The model sees results, not credentials.

What reaches the AI provider

To answer, the model has to read the relevant rows, so those rows go to the provider whose model you use. That is a decision the data owner should make visibly, per data source, with sensitive columns masked before anything is sent.

Making answers checkable

A good answer shows its working: which tables were read, which filters and aggregates produced the number. People trust what they can check, and catch the answers that are wrong.

Checklist

  1. 1

    Choose a tool where the model calls governed tools instead of writing SQL

  2. 2

    Enable it per data source, deliberately

  3. 3

    Make sure masking applies before data reaches the model

  4. 4

    Keep joins to real foreign keys

  5. 5

    Show the lookup trail with every answer

  6. 6

    Set a monthly spending cap

  7. 7

    Log every question

Common mistakes

Pointing a chatbot at a connection string

Convenient for a demo, and it gives the model everything. Put the same governed tools between the model and the data.

Not telling anyone data leaves

Rows sent to a model provider have left your system. Make that an explicit, per-source choice.

Trusting a number without its working

Answers without a lookup trail are hard to check. Show how each number was produced.

How DBShifts does it

  • DBShifts Data Console's Ask answers questions from your real rows using your own Anthropic or OpenAI key; DBShifts never supplies or bills for one.
  • The model calls the same governed, read-only tools the browse view uses: it generates no SQL and never receives a masked value.
  • Questions across related tables join and aggregate along real introspected foreign keys, so relationships cannot be invented.
  • Ask is off until enabled per data source, answers show their lookup trail, spend is metered monthly with a token cap on by default, and every question is written to the audit log.

Questions people also ask

Which AI models does it use?

Models from Anthropic or OpenAI with your own API key. You choose the provider and can choose the model.

Does it work on migration, masking or validation?

No. Ask is only for questions. Migration, schema conversion, masking and validation in DBShifts are deterministic and use no AI.

Related questions

Give AI agents data access you can defend

Scoped tokens, PII masked on the server, every request audited. Free to start.

Start free

18 answers in this series. See all.