Natural Language → SQL
Describe what you want in plain language; RaiseDB generates the SQL.
Where
- In the AI panel — just describe what you want
- Inline slash command — type
/and see the available commands
Note: there's no slash trigger in the SQL query editor. Only the AI panel accepts slash commands.
What the generator knows
Schema context
The generated prompt includes, per table in scope:
- Table name
- Each column: name, data type, NULL / NOT NULL, default, primary key
- Indexes with uniqueness and column list
- Foreign keys with local / referenced columns
Engine dialect
The model is told which engine family the connection targets, so LIMIT, OFFSET vs FETCH NEXT, backticks vs quotes, etc. come out right.
Mentions
@orders (or @schema.table) loads only that table — useful when the database is huge and you don't want the auto-overview.
Budget
The BudgetEnforcer estimator caps the schema section at ~60% of the model's context window. Long conversations get summarized.
Output rules
RaiseDB instructs the model to:
- Return SQL only inside a fenced
```sqlblock - Prefer SELECT, use LIMIT where appropriate
- Don't generate
DROP,TRUNCATE, orUPDATE/DELETEwithout aWHERE - Ask back if the question is ambiguous
The extractor prefers the last ```sql block; falls back to the last fenced block; falls back to the raw response.
Safety
After generation, every SQL block is passed through check_sql_safety_dialect (which respects the engine's $$, [], backtick syntax). Destructive patterns are flagged before they reach you. This is the safety check — it does not auto-execute anything.
Best practices
- Be specific — "orders in the last 30 days" beats "recent orders"
- Mention column names if you know them
- Ask for an EXPLAIN at the end of the prompt if you want the plan too