With Superset, you can define a SQL query to return results that contain the important information and metrics that you need for analysis. You can save those results as a virtual dataset to make them available for visualizations in Superset.
If you have a SQL statement for your virtual dataset already prepared, or if you plan to create the SQL statement on the fly, the best place to start is in the SQL Editor window. You can create and test your queries, verify that the query returns the desired combination of columns, and then jump to the Explore window to create a virtual dataset that can be used for visualizations of those query results.
To add a virtual dataset with a SQL statement view:
- On the SQL Editor window, create your SQL statement and run it to confirm that your results are as expected. It can be a good practice to save the query for easier troubleshooting and possible refinement. A simple example follows.
- When you are ready to create the virtual dataset, click Explore. A Save or Overwrite Dataset window opens.
You can choose to save and create a new virtual data set (with the name that you want), or you can overwrite an existing dataset. Choose the option you want and click Save & Explore (or Overwrite & Explore if that is the option that appears).
A chart window opens, preloaded with the new virtual dataset and a default table format. You can test and try out the dataset, and optionally, save the chart as a named chart.
- When you click a dataset in the Datasets window, this form of the Charts page opens to allow you to test the chart against the dataset. You can change the chart type and the data to review the information.
Updated about 1 month ago