Export compiled SQL and Jinja-SQL
Want to use your SQL somewhere else? We've got you covered.
If you want to export the SQL that generated a particular cell, you can use the Copy as -> Copy as SQL option on that cell (or the Copy SQL button in the design bar).
This will allow you to copy not only the SQL in that cell, but all of the cells it depends on as CTEs in the query.
Clicking Copy as SQL will open a modal giving you the power to configure how you would like your SQL exported.
In the above example, dim_customers depends on 5 other cells (which form the DAG). Two of the dependencies (stg_payments, stg_orders) have been toggled off, meaning they'll be exported as a dbt-ready Jinja ref. All other dependencies are exported as Count compiled CTEs.
- Save a cell you built as a view in your database
- Save a transformation you've done as a dbt model
- Use a cell you've built in another canvas (without copying over each cell)
If you're using the Compiled SQL for a dbt model, you'll have to update any Jjinja parameters before you commit back to dbt.