AI Assistant overview
Cmd+I opens the assistant. It writes SQL, explains queries, suggests fixes, and runs on whichever model you choose.
For: everyone, but especially developers and analysts.
The AI Assistant is a small panel that lives next to the query editor. Press Cmd+I and it opens. Type a question, get SQL back. Run the SQL, ask for an explanation, ask for an optimization. The assistant is aware of the database you're connected to.
Open the assistant
| Way to open | Where |
|---|---|
| Keyboard | Cmd+I |
| Toolbar | The sparkle icon top-right of the editor |
| Command palette | Cmd+K, type "ai" |
| Right-click in editor | "Ask AI..." |
The panel slides in from the right. It's pinned to your editor tab — switching tabs gives you a fresh AI conversation scoped to that tab.
What the assistant knows
Every prompt you send is wrapped with context about your current connection:
| Context piece | What it is |
|---|---|
| Database type | postgresql, mysql, or sqlite. The assistant adjusts SQL dialect accordingly. |
| Active table | If you're in Table Mode, the table name you're viewing is included. |
| Schema | The tables and columns in your active database, formatted compactly. |
| Selected text | If you've selected SQL in the editor, it's included as the focus. |
| The query at the cursor | The statement under the cursor, when no selection is active. |
The assistant does not see your data — only the schema. The result of a query you've run is not automatically sent. If you want to discuss results, you can paste them yourself.
The five things it does
| Action | Use it for |
|---|---|
| Natural language → SQL | Write a query from plain English (or French, or any language the model supports) |
| Explain | Take a SQL query and get a plain-language description |
| Optimize | Suggest a faster way to write the same query |
| Fix error | Read a database error and suggest the change to make it work |
| Generate schema | Sketch a CREATE TABLE from a description |
Each one is described in detail in explain / optimize / fix. The natural language flow has its own page: NL → SQL.
Pick a model
By default, QueryDeck uses Apple Intelligence (Foundation Models) when running on a Mac that supports it. It's local, free, and the prompts never leave the device.
You can switch to OpenAI, Anthropic, Ollama, or a custom OpenAI-compatible endpoint in Settings → AI. See providers for the full setup per provider.
Suggested prompts
When the panel opens with no conversation, you'll see a row of suggested prompts. The suggestions change based on what you're doing:
| State | Sample suggestions |
|---|---|
| Not connected | "Help me design a schema for a blog", "What does a good database client do?" |
| Connected, no table open | "How many tables are there?", "What's the largest table?" |
| Viewing a table | "Show me the 10 most recent rows", "What columns are NOT NULL?" |
| Query in editor | "Explain this query", "How can I make this faster?" |
Click a suggestion to use it as-is, or type your own.
Insert into the editor
When the AI returns SQL, the response has a "Insert into editor" button. Click it to place the SQL at the cursor in your editor tab. Edit, then Cmd+Return to run.
To copy without inserting, use the clipboard icon. To run directly from the panel without leaving the chat, press Run — the result appears in the chat as a small table.
Conversation history
Each editor tab keeps its own AI conversation. The conversation persists across app restarts. To clear it, click the trash icon at the top of the panel — this only clears the current tab's chat.
History is local to your Mac. Nothing is sent to QueryDeck servers.
When the AI is unavailable
The AI Assistant is gated during the trial along with the rest of the paid features. After the trial without a license, Cmd+I opens the panel and shows a "Trial expired" notice with a link to activate.
If your AI provider is unreachable (OpenAI API key invalid, Ollama not running, Apple Intelligence not available on this Mac), the panel shows a configuration error with a link straight to Settings → AI.
What's next
- Providers — Foundation Models, OpenAI, Anthropic, Ollama, custom endpoints
- Natural language → SQL for the most common use case
- Explain, optimize, fix for the three power features
- Privacy — what's sent, what stays local