The editor helps you write a query faster. It suggests names, offers AI suggestions, checks the syntax, formats the text and rewrites parts of the query. Use these tools while you write, before you run the query.
SETTINGS and the parameters you have added.Hover over a function name that is followed by ( to read its documentation, and type ( or , inside a call to see the parameters it takes.
In a query longer than 50,000 characters, the list stops appearing. In some smaller SQL boxes in other screens, it offers keywords and snippets only. The Autocomplete reference explains both.
DataMind's AI, Kartlos, suggests the next part of your query. You see a suggestion in two places:
The suggestion uses the tables of the selected role and your two latest runs of this console. A failed run is included with its error message, so the suggestion can help you fix it. For each suggestion, the editor reads up to 8 tables, up to 120 columns from each, and an 8,000-character window of the query around the cursor.
To turn suggestions off, click the sparkle button in the toolbar. Hover over it to see AI suggestions on - click to disable or AI suggestions off - click to enable. The setting applies to every tab in this browser.
FROM clause, or when the editor cannot find the tables it names.About a second after you stop typing, the editor checks the statement at the cursor. While it waits, the toolbar shows Pending…. While the check runs, it shows Checking…. If the cursor is not inside a statement, the check uses the first statement in the console. Placeholders like {name:Type} are set aside while the check runs, so they do not cause errors.
If the syntax is wrong:
The syntax check only reads the SQL. It does not check whether tables and columns exist. Unknown tables and columns are reported when you run the query.
Formatting applies to the whole console. Each statement separated by a semicolon is formatted on its own. Formatting changes the layout only: indents of 4 spaces, line breaks and keyword case. Keywords are shown in upper case, and names and aliases keep their spelling. Lines wrap at around 100 characters. If a change would alter anything else in the query, the result is discarded and your text stays as it was. Press Ctrl+Z to undo a format.
Put the cursor where you want to rewrite the query and press Alt+Enter. A list opens with the rewrites that apply at that point. Press ↑ or ↓ to choose, Enter to apply and Esc to close the list. Any other key also closes it. If no rewrite applies, nothing opens. Press Ctrl+Z to undo a rewrite.
| Rewrite | What it does |
|---|---|
| Expand column list | Replaces * with the columns of the tables in FROM and JOIN. |
| Extract subquery as CTE | Moves the subquery at the cursor into a WITH clause. |
| Inline CTE with the CTE's name | Puts the body of the CTE where it is used and removes its definition. |
| Convert statement to CTE | Turns the statement into a WITH clause and selects from it. |
| Convert statement to subquery | Wraps the statement as a subquery in FROM. |
| Add commas | Adds a comma after each selected value, except the last. |
| Add quotes & commas | Does the same as Add commas, and wraps unquoted values in single quotes. |
Some rewrites appear only in certain cases:
* refers to.Put the cursor on a table name and press Ctrl+B to open the table's popup in the Lake or Warehouse. The shortcuts window lists this as Open table in Lake/WH. If the name is written in quotes, the whole quoted name is used, so a name with spaces opens as itself. Without a table name at the cursor, the editor shows No table name at cursor.
To see AI suggestions, your role needs one of these permissions:
For the shortcut keys used on this page, see Editor reference: shortcuts and tools.
Check the Role selector. Suggestions come only from the databases of the selected role (see SQL dialect and data scope), so pick the role that can read the table. If the table is new, click the refresh button in the Database Explorer header. Its tooltip reads Refresh Schema. See Database Explorer.
Click the sparkle button in the toolbar. The setting is kept in this browser, in every tab. Your choice does not follow you to another browser.
Check that the sparkle button is on, keep typing and stop for about three seconds. Your role also needs one of the permissions listed above.
The syntax check only reads the SQL. It does not look up tables or columns, so those errors appear only when you run the query. Check the table name and run the query again. For other messages, see Editor troubleshooting.
Yes. Press Ctrl+Z after a format or a rewrite to go back one step. Press Ctrl+Y to redo.
Formatting changes layout only: indents, line breaks and keyword case. If the formatter cannot do that without changing anything else in the query, it discards the result and your text stays exactly as it was. Nothing is broken; the query is as you wrote it.
Paste one value per line and select those lines. Press Alt+Enter and choose Add commas. If the values are not quoted, choose Add quotes & commas to wrap them in single quotes as well. Add the parentheses around the list yourself.
Put the cursor after the *, press Ctrl+Space and choose Expand column list. You can also press Alt+Enter and choose the same item. It works only when the editor can find the columns of every table in the query.
The cursor is not on a table name. Click the table name itself, inside its quotes if it has them, and press Ctrl+B again.