Editor Pane
Last updated
Last updated
The DataAnalyst role must be assigned to each user who needs access to the Query Editor, including SuperAdmins.
Please be sure to use it cautiously, as it provides access to read potentially sensitive data.
The Editor Pane consists of three parts:
Queries can be written, edited, and run in multiple tabs to organize work.
The names of tabs can be changed by double-clicking the existing tab name.
Tabs can be dragged and moved to change their order. This lets users customize the Editor Pane to suit their workflow. Each user's tab order will be auto-saved for future sessions.
To open multiple editor tabs, click the plus sign after the last tab.
Hover over any tab and click the X to delete a tab.
Click the kebab menu (three dots) option to access additional features. The features available are :
You can access these shortcuts by clicking the kebab menu (three dots) option and then the 'Keyboard Shortcuts' button. They can also be accessed by pressing the 'F1' key.
The following shortcuts are available for the specified actions.
This feature is used to beautify the SQL query in the currently active tab. In the case of lengthy query text, the formatting process may require some time, during which a progress bar will be displayed to indicate the formatting status.
This feature duplicates the current tab, preserving the executed queries only. The results will not be copied to the new tab.
If the Cluster used to run the query is suspended, the user will be asked for consent to resume the Cluster before the query is run.
A query can be run from the editor in two ways:
Click the Run button
Press Cmd + Enter
By default, all queries in a tab are run and the results of the last query will be displayed in the Result Pane.
To run only one query, see Selectively Run Queries.
If multiple queries are run and there is an error in any query, the execution of all queries will be aborted and no results will be displayed.
The query containing the error will be highlighted in red.
When a query is running the Run button will change to Cancel. Click Cancel to stop any running query.
A default LIMIT can be set to prevent inadvertently running queries without a defined LIMIT, which may incur high infrastructure costs.
To set a LIMIT, click the drop-down arrow next to the Run button and select the desired limit.
The LIMIT options are:
NO LIMIT: The query will run till all results are available.
LIMIT 10: The query will stop executing after the first 10 results are available.
LIMIT 100: The query will stop executing after the first 100 results are available.
LIMIT 1000: The query will stop executing after the first 1000 results are available.
The Query Editor will display only the first 10,000 results. To access more than 10,000 rows use an external connector.
Select from the list of attached catalogs, which should be used.
Select from the list of databases inside the selected catalog.
Set the cluster that should be used to execute queries.
Click the <|> (Format Query) button to beautify the SQL query in the currently active tab.
You can save a query for future use by clicking the Save button.
The SQL query text should be entered in the SQL Query Editor.
Although multiple queries can be written in the same tab, if a user wants to run only one query, simply place the cursor on the line containing the query (before the :
), prior to clicking Run.
If the cursor is on the last line of the SQL Query Editor, only the last query will be run.
Queries can also be commented out using standard SQL syntax --
(single-line comments) or /* */
(multi-line comments).
As you type a query, the SQL editor suggests commands and functions, suggesting various ways to finish the command or function you've started. To select a proposal, hit the Tab key to accept it, or keep typing to dismiss the dialogue window.
The Find & Replace feature can search or replace strings that match a pattern in the query text.
Press CMD + F (MacOS) or CTRL + F (Windows) to bring up the search dialog.
Type the string to search for in the Search for... field.
The search will start highlighting matches when the first character is entered.
Use the < and > buttons to toggle between appearances of the search string.
Click the All button to highlight all appearances of the search string.
Click the + button to open the Replace field.
Type the string to search for in the Search for... field.
Enter the string that should replace the search string in the Replace with... field.
Click Replace to replace only the current selected instance of the search string, or click All to replace all instances.
Click the .* button to enable the RegExp search feature.
Enter the regular expression to search for in the Search for... field.
Click the Aa button to toggle on case sensitivity in search.
Click the \b button to toggle on Whole Word Search, this will return only complete matches to the search string.
Click the S button to toggle on Search in Selection which only searches within the lines selected by the user.
Error highlighting helps identify and rectify errors in the queries. In case of any error, the line or query paragraph containing the error will be highlighted in the query editor.
Action | Shortcut |
---|---|
Run Query
<cmd> + enter
Abort Query
<cmd> + esc
Find and Replace
<cmd> + f
Format Query
<cmd> + shift + o
Show/Hide Result
<option> + shift + t
Undo
<cmd> + z
Redo
<cmd> + shift + z
Show keyboard Shortcuts
F1