AI assistant
Generate, explain, and optimize SQL with your own API key — grounded in your live schema.
The AI assistant is a side-by-side chat panel that understands the active connection's schema. Ask it to write, explain, or fix SQL, and it drafts a query grounded in your actual tables and columns — not a guess at their names.
Bring your own key#
There is no built-in AI backend and no usage fee. Add your own API key in Settings → AI for one of:
- OpenAI
- Anthropic Claude
- Google Gemini
- OpenRouter
- z.ai (GLM)
- any OpenAI-compatible custom endpoint
Keys are stored locally on your machine, and requests go directly from the app to the provider — never through an rdSQL server.
Working with the assistant#
- Open the assistant panel from a connection or a SQL editor tab.
- Ask in plain language — "show me the 10 most recent orders with their customer name" — or paste a slow query and ask for optimization suggestions.
- Review the generated SQL before running it. Read-only statements (
SELECT,SHOW,EXPLAIN, …) can run immediately from chat; anything that writes or changes schema —INSERT,UPDATE,DELETE,DROP,TRUNCATEand friends — always stops at a confirmation dialog showing the exact SQL and the target connection first.
The assistant's context includes the active connection's tables, columns, and keys, so generated queries reference real schema. It can also explain a schema back to you — useful when you inherit a database.
Troubleshooting#
- "No AI provider is configured yet" — add an API token in Settings → AI first; the assistant is inert until a provider is set.
- Generated SQL references wrong table or column names — make sure the connection's schema has finished loading before asking; very large schemas take a moment to index.
- Custom endpoint doesn't respond — confirm the base URL is OpenAI-compatible and reachable from your machine.
