Skip to content
Docs menu

Analysis

SQL editor

Write SQL against every synced table and model, using DuckDB's dialect, and know the limits.

The SQL page is a full SQL editor over everything in your workspace. Your source systems' reporting limits don't apply: you can join across systems, use window functions, and query years of history.

The editor

  • Autocomplete covers every synced table, column and model in the workspace.
  • Run with ⌘↵ (Ctrl+Enter on Windows).
  • The Tables panel lists your tables, grouped by connection.
  • Explain describes what the selected SQL does, in a few sentences.
  • Save as model turns the query into a model.
  • Work is kept in named tabs that are saved on the server.

Dialect

Datachef runs DuckDB's SQL dialect. It's close to PostgreSQL, with useful extras:

-- Group by every non-aggregated column
SELECT region, plan, sum(mrr) FROM sample.customers GROUP BY ALL;

-- Filter on a window function without a subquery
SELECT * FROM salesforce.opportunity
QUALIFY row_number() OVER (PARTITION BY accountid ORDER BY closedate DESC) = 1;

-- Exclude a column from SELECT *
SELECT * EXCLUDE (description) FROM salesforce.account;

Naming tables and models

WhatHow to refer to itExample
A synced table<connection name>.<table>salesforce.opportunity
A database table outside the default schema<connection name>.<schema>_<table>warehouse.sales_orders
A modelIts nameactive_customers

See connection names.

Read-only

Every query is read-only:

  • One statement per query, and it must be a SELECT (including WITH ... SELECT).
  • Statements that write data or reach outside the workspace are refused. That includes ATTACH, COPY, INSTALL, PRAGMA, and functions that read files or URLs.
  • A query can only see tables and models in its own workspace.

Limits

LimitValue
Rows shown in a result10,000. A larger result is marked as truncated.
Rows in a CSV export1,000,000
Query time60 seconds

If you hit the row limit, aggregate in SQL instead. Summing or counting in the query is faster than pulling the rows out.

Something missing or wrong on this page? Tell us