When you start working seriously with Apache Superset, one concept that quickly becomes central is the idea of a dataset. Every chart, dashboard, and slice you build depends on it.
But Superset gives you two ways to define datasets:
· Physical Dataset
· Virtual Dataset
At first glance, they might seem interchangeable. In reality, they serve very different purposes, and choosing the wrong one can lead to performance issues, poor maintainability, or unnecessary complexity.
Let’s understand these in detail.
1. What is a Dataset in Superset?
In Superset, a dataset is a logical abstraction over your data source (table or query). It defines:
· Columns and metrics
· Data types
· Filters and calculated fields
· Metadata used by charts
Think of it as the contract between your raw data and your visualizations.
2. Physical Dataset
A Physical Dataset is a direct mapping to a real table or view in your database.
Example
SELECT * FROM sales.orders;
When you create a physical dataset, Superset simply points to:
· A table (orders)
· Or a database view
Follow below step-by-step procedure to create physical dataset.
Navigate to Dataset listing page.
Click on Create Dataset (+ Dataset) button to create a physical dataset.
Select the Database, schema and table name from the dropdown.
Click on ‘Create dataset’ button available at bottom of the screen.
Upon successful creation of the dataset, you will be navigated to the dataset listing page, here you can confirm that dataset type is set to Physical.
3. Virtual Dataset
A Virtual Dataset is created using a custom SQL query inside Superset.
Example
SELECT * FROM products WHERE price > 25000
Navigate to SQL -> SQL Lab
Write the query and execute
After Executing the query, Click on Save dataset button.
Give the dataset name as ‘Costly Products’, click on Save & Explore button.
Navigate to Dataset listing page, you can see a virtual dataset.
Previous Next Home







No comments:
Post a Comment