Docs / Using SayQL
Run queries safely
Updated
SayQL is built so that pointing it at a production database isn't scary.
Read-only by default. SayQL checks every statement before it runs. Anything that could change data or structure (INSERT, UPDATE, DELETE, DDL and so on) stops and shows a confirmation first.
- Run several statements: statements separated by
;run one after another, each in its own results tab. Each one that could change data asks first. The run stops at the first error, or at a change you decline, and its tab shows where it stopped. - Run part of a query: select some SQL in the editor and click Run selection (or press ⌘↵) to run only that. If the selection cuts a statement in half (say, a
DELETEwithout itsWHERE), SayQL runs the whole statement instead, highlights it, and shows Ran the full statement(s). A complete subquery inside brackets runs as selected. The same read-only checks apply. ↵ in the Ask box always runs the whole query. - Cancel a slow query: while a query runs, click Cancel next to Run. SayQL asks the database to stop the statement, so it doesn't keep running on the server. In a script, the statements after it don't start.
- Run when ready: while the AI is still writing, the button reads Run when ready. Click it, or press ↵, and the query runs as soon as it's written.
- Above the editor, Save keeps the query as a script and Clear empties the editor.
- Writing SQL yourself: the editor suggests your tables and columns as you type (Ctrl+Space shows them any time). ⌘F finds, ⌥⌘F replaces, and ⌘/ comments lines out.
- Reads also run inside a read-only transaction (PostgreSQL and MySQL) or on a read-only connection (SQLite), so the database itself refuses writes. SQL Server has no read-only mode, so reads run in a transaction that's always rolled back. For production SQL Servers, use a login that can only read (
db_datareader). - Results show up to 5,000 rows. Use
LIMIT/TOPor filters for more focused results. Copy as CSV copies the rows shown.
Tabs and saved scripts
- ⌘T opens a new SQL tab on the current database. Each tab keeps its own question, SQL and follow-up history.
- ⌘S saves a tab as a script. Saved scripts appear under Saved scripts in the navigator and reopen on the database they were written for.
- Saved scripts shows the scripts for the open database; click All on that row to see every script.
- Right-click a tab to close it, the others, the ones to its right or left, the saved ones, or all of them, or to duplicate it. Closing a tab with unsaved SQL asks whether to save it first.
Something missing or unclear? Ask in Discussions.