Skip to main content

Create a dataset

A dataset is a table or a query you've named once. Charts, dashboards, alerts and Insight AI all read from datasets, so everyone builds on the same definition of your data.

What a dataset is

You connect a database, explore it in SQL Lab or Python Lab, and keep what you need as a dataset. Every chart is built on exactly one dataset. Datasets are one of two kinds:

Physical (Table)
A table or view in a connection, used as it is: Orders, Customers.
Virtual (SQL Query)
The result of a query: joins, filters or pre-aggregated figures, such as revenue per month and region.

Four ways to create one

Start fromBest whenKind
A tableThe table already has one row per thing you want to chart.Physical
A SQL queryYou know the SQL and want to type it straight in.Virtual
SQL LabYou're exploring and want to keep the query you just tested.Virtual
Python LabThe numbers come from pandas: reshaping, statistics or a model.Import of the result

From a table

  1. Start a new dataset

    Open Datasets and choose Create Dataset.

  2. Choose where the data is

    Enter a Name, pick the Database (connection) and, if it has several, the Schema.

  3. Name the table

    Leave Source on Table and enter the Table name. For an uploaded file, the table has the connection's name.

  4. Choose the query mode and create

    Pick Direct Query or Import Query (see below) and choose Create.

From a SQL query

In the same dialog, set Source to SQL Query and type the query in the SQL box. The dataset's columns are the query's columns.

From SQL Lab

The most common route: explore, get the query right, keep it.

  1. Run the query in SQL Lab

    Write and run the query until the results are what you want to chart.

  2. Choose Dataset

    In the toolbar above the editor, choose Dataset. Enter a Dataset Name and a Description / Business Context.

  3. Choose the query mode and save

    Pick Direct Query or Import Query and choose Save. DataViz then offers Create Chart, which opens the chart editor on the new dataset.

What the video shows: In SQL Lab a query is typed that totals revenue and margin for each product category, and Run Query lists the five categories. Dataset opens Save Dataset; the dataset is named Revenue and margin by category and saved. Create Chart, offered straight after, opens the chart editor on the new dataset, where the chart type is switched from Table to Bar, category goes on the X axis and revenue into the metrics, and the preview draws a bar for each category.

From Python Lab

  1. Run a script that outputs a table

    In Python Lab, show the DataFrame you want with lab.output("name", df) and run the script.

  2. Choose Dataset and save

    Choose Dataset, check the shape and columns shown, enter a name and description, and choose Save Dataset.

A Python dataset stores that run's result. DataViz doesn't run the script again by itself: run it again and save to update the numbers, or use a workflow to run Python on a schedule.

Live or imported

Direct Query
Charts read the database each time they need data, so they're always current. Results can be cached briefly so a busy dashboard doesn't repeat the same query.
Import Query
DataViz stores a snapshot (Parquet files read with DuckDB) and charts read that instead: fast, and no load on your database. The snapshot is refreshed on a schedule or whenever you refresh it.

Choose import for slow or expensive sources, such as a warehouse that bills per query, and direct for anything that has to be up to the minute.

Import settings

Refresh schedule
Manual, Hourly, Daily or Weekly.
Incremental key
Optional. A column that only grows, such as updated_at or an id. With one, a refresh adds only rows past the last one it saw, instead of replacing everything.
Partition column
Optional. A column, usually a date, to split the stored snapshot by, which speeds up reading large imports.

Saving from SQL Lab or Python Lab calls these Full Refresh (replace everything) and Semi Refresh (add new or changed rows using the incremental key, optionally merging on unique key columns).

The Datasets page

Each card shows the dataset's source, mode, size and when it was last updated.
Filters
All, Physical or Virtual, and by status.
Grid or list view
Cards or a compact table.
Export datasets
Download the list.
On each dataset
Create chart from dataset, Edit dataset and Delete dataset.

Then chart it

Choose Create chart from dataset on the dataset, or Create Chart right after saving from SQL Lab. Before you share it widely, give the dataset metrics and column descriptions: Metrics, columns and settings.