Query editor
The editor is the place where you write your SQL. It knows your database schema and helps you write your queries with autocomplete, syntax highlighting and linting.
Writing queries
Query files
- Query files are saved per data source, each is represented by a SQL editor
- Create one by clicking
New queryin the main left menu (orCmd/Ctrl+N) - Contents of the files are stored in Rowpilot's internal database
- Save your query edits manually by clicking
Savein the editor toolbar (orCmd/Ctrl+S)- Autosave is available in
Settings → Editor
- Autosave is available in
Statements
- The editor can contain one or more standalone SQL statements
- Each SQL statement is separated by
;
Autocomplete
- Suggestions come from the live schema of the connected data source: tables, columns, functions.
- Syntax highlighting follows the dialect of the data source.
Inline suggestions (tab-completion) are available in Settings → Editor
Linting
- SQL linting checks your query against the schema and marks problems, like a column name typo or other issues
Formatting
Format the current query with Shift+Alt+F or from the context menu (right click inside the editor -> Format...)
Running queries
- Run your SQL query by clicking
Runin the editor toolbarRun allin case of multiple statements
- Run shortcut -
Cmd/Ctrl+Enter- Single statement: runs the query
- Multiple statements: dialog with a choice between running all and running the nearest query statement
Transaction modes
- Query runs honor selected transaction mode
Query results
- Results from query statements appear in the data grid
- The grid shows up automatically if the query contains result data
- Toggle the result grid by clicking
Resultsin the bottom right toolbar
- Executions or error results show up in the output log
- The output log shows up automatically in case of a query error, a detected execution or a query without results
- Toggle the output log by clicking in the bottom right toolbar
Query parameters
Queries can declare parameters that get passed at execution time
- Use a standardized parameter patterns in your SQL and the parameters are auto-discovered
Supported parameter patterns
| Pattern | Example | Type |
|---|---|---|
| Colon | :varName | Named |
| At | @varName | Named |
| Dollar-curly | ${varName} | Named |
| MyBatis | #{varName} | Named |
| Python | %(varName)s | Named |
| Dollar | $1 | Positional |
| Question mark | ? | Positional |
? is not treated as a parameter due to jsonb operator.- Set parameters by clicking in the editor toolbar
- Hidden and nullable params are supported
- Parameter values are stored encrypted
List parameters
- To capture a list parameter for
inconditions mark the parameter aslist - The parameter must be placed within braces
(...)
SELECT *
FROM orders
WHERE status in (:statuses);
Searching in files
Global search using or Cmd/Ctrl+K covers both query file names and their content
Generator palette
Cmd/Ctrl+G opens a small palette for values you constantly need mid-query: UUIDs, unix timestamps or random passwords. Generate, copy, paste and keep typing.
Shortcuts
The full list lives in Keyboard Shortcuts, and you can rebind any of them in Settings.
