In modern data platforms, visualization alone is not enough, users need flexibility to explore, transform, and shape their data before turning it into insights. This is where Apache Superset’s Custom Dataset capability via SQL Lab becomes a game changer.
This tutorial is designed to help you understand how Superset evolves from a simple dashboarding tool into a full-fledged data exploration environment, empowering you to write SQL, analyze results, and instantly build visualizations.
In this post, we’re going to learn one of the most powerful and practical features in Superset, Custom Datasets using SQL Lab. This feature fundamentally changes how you work with data in Superset. Instead of being limited to predefined tables, you can now:
· Write your own SQL queries
· Shape and transform data as needed
· Instantly convert results into datasets
· Build visualizations on top of them
In short, it turns Superset into a complete data exploration workspace, not just a visualization tool.
Step 1: Accessing SQL Lab
To begin, Navigate to the top menu, Click on SQL → SQL Lab
You’ll land in a powerful interface designed for querying and exploration.
Step 2: Understanding the Interface
SQL Lab is thoughtfully divided into key sections:
Database Selector: Choose the database you want to work with. Make sure your database is already connected to Superset.
Schema Selector: Most databases organize tables into schemas (like public). Select the schema that contains your target tables.
Table Explorer Panel: On the left side, you’ll see a list of tables:
· Expand any table to view its columns
· Helps avoid memorizing table structures
· Especially useful for large or complex schemas
SQL Editor (Core Workspace): This is where the real magic happens:
· Syntax highlighting
· Auto-completion
· Query formatting
· Smart suggestions for tables and columns
It provides a developer-friendly experience similar to modern IDEs.
Write the Query and click on Run button to see the Query results.
Step 3: Create Dateset.
Here’s where Superset becomes truly powerful. After running your query, Click "Save dataset" button.
Enter some meaningful name to the Dataset, click on Save & Explore button.
It takes you to the Chart page.
From here, you can:
· Build charts
· Apply filters
· Add to dashboards
One important thing to understand is that this dataset is query-based, not static. That means, every time a chart uses this dataset
Superset re-executes the SQL and your dashboards always reflect the latest data.
That’s all for this post. In the next video, we’ll build on this foundation and explore how to create compelling visualizations from these datasets.
Previous Next Home



No comments:
Post a Comment