Search code examples
apache-superset

Saving SQL Lab query as dataset?


currently, to create a virtual dataset in superset, I create a dataset based on a physical table and edit it afterwards. This feels not as straight forward as I expected, so perhaps there is a better way to do this? I especially expected a way to create a dataset from a SQL Lab query.

Am I missing an option to do so?

Thx, Holger


Solution

  • Good question. A virtual dataset in Superset is more / less really just a query (albeit with some optional additions, like jinja templated variables).

    • SQL Lab to virtual dataset: When you're in SQL Lab, any query you run can be published as a virtual dataset by clicking "Explore". You'll be then asked to give a name to the virtual dataset and a no-code Explore workflow will be kicked off with this virtual dataset as the data context / input!

    • Editing existing virtual dataset: To edit the virtual Dataset (which again is mostly a SQL query), you select Edit from the Datasets tab next to the line item for your dataset.

    I think the first bullet is what you're looking for :)

    The following documentation may also be helpful: https://docs.preset.io/docs/sql-editor#results-tab