Skip to main content

The SQL Runner

The SQL runner is used to build ad-hoc queries or charts using totally custom SQL. Charts built using the SQL runner can be shared, but can't be saved or added to a dashboard.

Only users with developer or admin access can use the SQL runner.

Building a chart using the SQL runner

The SQL runner can be accessed from the new --> Query using SQL runner option in your navigation bar.

Once you're in the SQL runner, you'll see two key components:

  1. A list of tables that correspond to all of the models in your connected dbt project.
  2. A SQL query builder.

Only tables included in your dbt project are shown in the sidebar, but you can query any tables that your Lightdash data warehouse connection has access to (this is based on the data warehouse credentials that you setup in your project connection settings).

Once you've run your query, you'll see the query's results and a chart created in the chart panel.

We assume that any numeric type values in your query results are metrics and non-numeric values are dimensions. If you need to have a numeric value treated as a dimension (e.g. for pivoting), then we recommend casting your numeric values as strings, like: CAST(my_number_value AS STRING) AS my_number_value.

Sharing a chart from the SQL runner

Once you've created your chart, you're able to share it either by:

  1. Sharing the link in the browser
  2. Sharing the link from the copy link button

It is not possible to save a chart from the SQL runner or add it to a dashboard.