Documentation › SQL Lab
Saved queries and datasets from SQL
Save SQL Lab queries, share them, turn a query into a virtual dataset, and build charts from query results.
Save a query
- In SQL Lab, click Save (next to Run).
- Give it a Name and an optional Description.
- Click Save.
Saved queries are listed under SQL → Saved queries and on Home. Their parameters and values are saved with them. Click a saved query to open it in SQL Lab. Share copies a link to it for colleagues in your organization.
Saved queries can also be run through the API (a query key can run one specific saved query), which makes them useful as a data feed for other systems.
Create a dataset from a query
A query that joins or prepares data can become a virtual dataset, so charts can use it like a table.
- Run the query in SQL Lab.
- Click Save → Save dataset (the arrow next to Save).
- Choose Save as new and give it a name, such as Sales with branch details. Or Overwrite existing to update a virtual dataset you created before.
- Click Save & Explore to start a chart on it.
Tips for virtual datasets:
- Give every computed column a name with
AS, such asSUM(revenue_ugx) AS revenue. - Don't end the query with
ORDER BYorLIMIT. Charts add their own. - Keep row-level detail when you can (one row per order, not per month), so charts can group and filter freely, and define the aggregates as metrics.
- Parameters (
{{ ... }}) stay in the dataset and become chart filters.
Build a chart straight from results
After running a query, Create chart opens the chart editor on the result. Embiro BI saves the query as a virtual dataset when you save the chart.
Something unclear or missing? Tell us and we'll improve this page.