Skip to content

Using the assistant

Open a SQL editor and click AI. The assistant panel opens beside the editor. Configure a provider first — see Setting up a provider.

Asking a question

  1. AI connection — pick which configured provider to use.
  2. Query — describe what you want in plain language: "total revenue per month for 2026, only paid orders".
  3. Include current SQL — sends what is in the editor, for "why does this return duplicates?" or "rewrite this without the subquery".
  4. Tables (for context) — click + Add table to choose which tables the model should know about. The labels show how many tables are contributing schema and how many are contributing a data sample.
  5. ▶ Send.

Before you send

Request preview shows the exact JSON that will be transmitted, with a character count. Open it whenever the question involves tables with sensitive content — it is the difference between assuming what leaves your machine and knowing.

The character count is also a rough gauge of cost with metered providers.

Working with the answer

The response arrives in the panel with four actions:

ActionEffect
Copy SQLCopies just the SQL from the answer
Copy to editorInserts it straight into the editor
View full responseThe complete reply, prose and all
ClearEmpties the panel

Read the SQL before you run it

The model does not know your data volumes, your indexes or your business rules, and it will occasionally produce a statement that is syntactically fine and semantically wrong. Check WHERE and JOIN clauses in particular before running anything that writes.

For UPDATE and DELETE, run the equivalent SELECT first and look at what comes back.

Getting better answers

  • Add the relevant tables. Without schema, the model guesses column names — and it guesses plausibly and wrongly.
  • Say what you mean by the terms. "Active customers" means one thing in your schema and another in someone else's. "Active = no cancelled_at and an order in the last 90 days" gets the query you wanted.
  • Iterate. Send the generated query back with "this counts refunds twice, fix it" rather than starting over.
  • Use the system prompt for anything that is true of every question — the SQL dialect, your naming conventions, "always use explicit JOIN syntax".

When the model is the wrong tool

  • Exploring a schema you do not know → the ER diagram and the visual query builder.
  • A slow query → the profiler. The plan tells you what is actually happening; the model can only guess.
  • Repeated production work → save the query once it is right, so it stops being generated afresh each time.