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

Use double-curly-brace syntax to define parameters in your SQL:

sql
SELECT *
FROM orders
WHERE status = '{{status}}'
  AND created_at >= '{{start_date}}'

When you run a parameterized query, DataRunner prompts you to fill in each parameter value. You can also set default values for each parameter in the query settings panel — these are used when no runtime value is provided.

Parameters work the same way in scheduled reports: configure default values on the query and override them per schedule if needed.

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

Parameter types

DataRunner infers parameter types from context. Supported types:

  • textdefault; renders as a text input
  • numberrenders as a numeric input; passed as a number to the driver
  • daterenders as a date picker; passed as YYYY-MM-DD
  • datetimerenders as a datetime picker; passed as ISO 8601
  • booleanrenders as a toggle; passed as true or false

Override the inferred type by adding a type annotation in the parameter name: {{start_date:date}}.

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.