Query

Full-featured SQL editor for warehouses and files with caching and AI assistance

The Query cell is your fully featured SQL editor inside Livedocs.
It lets you query data from either:

  • A data warehouse (Postgres, Snowflake, BigQuery, etc.)
  • A file (CSV, Parquet, etc., queried with DuckDB)

Selecting a Source

  • Pick your source from the dropdown.
  • SQL dialect automatically matches the source:
    • Postgres connector → Postgres SQL
    • Snowflake connector → Snowflake SQL
    • Clickhouse connector → Clickhouse SQL
    • BigQuery connector → BigQuery SQL
    • Files → DuckDB SQL (default)
  • Note: Postgres tables are attached in-memory to DuckDB for queries.

Execution & Performance

  • Queries run in the warehouse compute where possible.
  • Results are returned as a Polars DataFrame.
  • Caching:
    • On the first run, the DataFrame is cached in memory.
    • Subsequent runs (without query changes) return from cache instantly.
    • To force fresh results, click the dropdown on the Run button → Run without cache.
  • Results are paginated for large datasets.

Editor Features

  • Fullscreen Mode: Hover over the cell header → click the three dots (More Menu) → Expand.
  • AI Assistance: Click the bolt icon ⚡ to open a new chat with your preferred model to:
    • Write queries
    • Debug queries
    • Explain results

Working with Results

  • Click result column headers to:
    • Filter
    • Sort
    • Color cells
  • Add column-level aggregate functions like:
    • SUM
    • COUNT
    • AVG

Example

-- Querying a local CSV with DuckDB
SELECT customer_id, SUM(total) AS total_spent
FROM 'sales.csv'
GROUP BY customer_id
ORDER BY total_spent DESC
LIMIT 10;