Write SQL in the editor
Draft SQL against the editor’s own target, then review formatting, completion, search and file actions before execution.
When to use this
The SQL Editor keeps query text and an execution target together. Editing text does not run it or save a local file.
Use it to compose or revise a query while checking the connection and database it would use.
Before you start
Open the intended workspace and database tab. Keyword and snippet suggestions can work without metadata; table and column suggestions need a matching database context.
Steps
- Choose AI & Sql Editor → Open Sql Editor (default Ctrl+Shift+U / ⌘+Shift+U). Opening from a current table can fill a short SELECT; review any existing text before changing it.
- Draft a read-only query for a demo target, or explicitly load a local SQL file. Use completion or a snippet to insert text, then review the resulting names and syntax.
- Use Format SQL for the document or open Find and expand its Replace controls for text edits. Formatting changes the document text; neither action runs SQL.
- Before using an execution action, compare the editor’s connection/database status with the intended database tab and Schema. The editor target is carried into execution; a mismatch prompts for confirmation.
How to verify the result
The editor shows the reviewed SQL text and connection/database context. The query remains unexecuted until an execution action is chosen.
Troubleshooting
- If table or column completion is empty, check the editor target, available metadata and autocomplete settings. Try a keyword or snippet suggestion to distinguish metadata availability from a disabled completer.
- If the target differs from the intended database tab, stop before running. Activate the intended tab, reopen the editor if needed, and review its target and text again.
- If a loaded file appears wrong, confirm it is UTF-8 before saving. Loading replaces editor text; Save To File writes a local .sql file, while Save To History creates a separate workspace entry.
Limits
- Opening or reopening the editor can refresh its target from the active database tab and prefill SQL for the current table. Recheck both target and text before running.
- Table-name chooser actions inspect current open database or table tabs; inserted backtick names are not proof that the editor target or dialect is correct.
- Completion depends on settings, metadata and dialect. Local SQLGlot validation checks parsing only; it does not establish server acceptance or safety.