Skip to content
queries
Queries

Queries

The SQL Workbench is where you write, test, and manage your queries. It uses Monaco — the same editor that powers VS Code — with schema-aware autocomplete, multi-tab support, and live result previews.

Read
6 min
Sections
6
Editor
Monaco / VS Code

The SQL Workbench

Access the workbench by clicking Queries in the sidebar. Each query opens in its own tab. The layout has three main areas:

  • Schema sidebar (left)expandable tree of all tables and columns for the selected connection
  • Editor (top)Monaco SQL editor with syntax highlighting and autocomplete
  • Results panel (bottom)table view of query results with row count, duration, and export options

Keyboard shortcuts

Ctrl+EnterRun selected SQL (or full query if nothing selected)Ctrl+Shift+FFormat SQL (auto-indent and keyword casing)Ctrl+/Toggle line commentCtrl+KOpen command paletteCtrl+TOpen a new query tab

Connections in the workbench

The connection selector at the top of the workbench determines which database the query runs against. Autocomplete, schema browsing, and query execution all use the selected connection.

You can change the connection mid-session — the editor content is preserved. If your query references tables that don't exist in the new connection, DataRunner will surface an error when you run it.

Parameters

Parameters are named placeholders written as :name in the SQL:

sql
SELECT *
FROM orders
WHERE status = :status
  AND created_at >= :start_date

-- Note the placeholders are NOT quoted. ':status' inside quotes is a
-- literal string, not a parameter — the binder deliberately skips
-- anything inside quotes, comments, or a Postgres ::type cast.

When you run a parameterised query, DataRunner prompts you to fill in each value. Set default valuesin the query's parameter schema — those fill any gap the caller leaves. Placeholders are rewritten to the driver's native form and bound, so a name that appears twice is supplied once.

Scheduled runs use the query’s declared defaults. A schedule has no parameter store of its own, so to run the same SQL on two cadences with different values, give each variant its own query.

Security: Parameters are passed as prepared statement bindings, not string interpolation. This prevents SQL injection regardless of what value is passed.

Parameter types

A type is declared per parameter in the query's parameter schema, not inline in the SQL. It decides how the value is coerced before binding:

  • string / textpassed through as text
  • int / integer / longparsed to a 64-bit integer
  • number / decimal / double / floatparsed to a double
  • bool / booleanparsed to true / false
  • datecoerced to a date-only value (YYYY-MM-DD)
  • datetime / timestampcoerced to a UTC timestamp

Leaving the type blank is a valid choice: the value is then passed as-is and the driver infers from the runtime type. Declare a type when the input arrives as a string — from a form field or an API call — and the column is not text.

Autocomplete

The autocomplete engine pulls from the live schema of the selected connection. Start typing a table name and the editor suggests matching tables. After selecting a table and typing a dot, it suggests columns. SQL keywords, functions, and window functions are also included.

Autocomplete triggers automatically after a short delay, or immediately with Ctrl+Space. If the schema changes (new table added, column renamed), click Refresh schema in the schema sidebar to reload.

Results panel

After running a query, results appear in the panel below the editor. The panel shows:

  • Row counttotal rows returned (or affected, for DML)
  • Durationquery execution time in milliseconds
  • Table viewpaginated result table with sortable columns
  • Chart viewswitch to a line, bar, or pie chart for quick visualization

Export the current result as CSV or Excel directly from the results panel without saving the query first.

Query library

The Library stores saved queries and SQL snippets that can be reused across reports and watches. Access it from Library in the sidebar.

To save a query to the library, click Save to library in the workbench header. You can add a title, description, and tags. Library items are workspace-scoped — all members can see and fork them.

Snippets are shorter reusable SQL fragments (a CTE, a WHERE condition, a common join). Insert a snippet into any open editor tab from the library panel.