Switchboard Docs
Lakehouse

Query your data with SQL

Inspect data in the SQL Scratchpad.

Use SQL Scratchpad to inspect tables without adding a chart to a document. SQL is a language for selecting and combining rows from tables.

Before you start

You need permission to query models and source data. Custom roles can restrict either operation. The built-in roles include data viewing permissions; access to particular items can still differ. For useful results, connect a source or build a model first.

Run a query

  1. Select SQL editor in the app's upper toolbar. The SQL Scratchpad opens beside the page.
  2. Open Data browser to find the available models and sources.
  3. Read the SQL dialect label. Use that syntax for functions and date operations.
  4. Write a query. Start with a small row limit.
  5. Select Run (Cmd+Enter).
  6. Inspect the columns and result rows. Read any error before editing the query.

To check the editor without using business data, run:

SELECT 1 AS example_value

The result contains one row with example_value equal to 1. For a real table, use a model ID from the data browser:

SELECT *
FROM {{models.orders_output}}
LIMIT 20

Replace orders_output with an existing model ID. A display name and a model ID can differ. See the SQL reference for table references.

Run selected SQL

Select SQL text and choose Run selection to run only that text. Use Format to arrange the SQL for reading. Formatting does not validate the result.

Use a query in a document or model

Use Explore with SQL to put a SQL result into a document. For a reusable business definition, create a model instead.

If a query fails, check the table ID, column names, dialect, and data access. A source sync or model build can also be incomplete. Check those statuses before treating an empty result as missing data.

On this page