Reusable CTEs
Archived
From CTE to Lineage, it showed how to visualize CTEs into Lineage diagram.
Now, let's say we want to create snippet template from these CTEs.
Creating views
How-to save query into snippets in Datascale. On the right, click properties
Click on Category drop down, and select type to View.
Unlike dbt, you can reference green_trips
view in another view by its name directly.
The different here is, we use CTEs to reference views in the main query.
WIP: we are working on automatic import from just NAME. i.e., only need SELECT * from total_trips;
and no need WITH green_trips AS ( {{ ref("green_trips") }} ) to be referenced in CTE.
Open params menu on the right, you'll see referenced views in this query. This concept works like importing code snippets from templates.
Hit compile to see compiled code.
Open Diagram menu to see the lineage.
Last updated