I’m trying to make one model in dbt depend on another (trying to run the second model after the first one is completely finished), but I’m confused, when to use ref()
or source()
?
What is the difference between them?
I’m trying to make one model in dbt depend on another (trying to run the second model after the first one is completely finished), but I’m confused, when to use ref()
or source()
?
What is the difference between them?
Using ref
creates the lineage for your DAG and will run the predecessor models. Using source
references a base table that is not necessarily a model. Rule of thumb is use source
in your base models and everything else should use ref
.
Example - Green nodes represent tables ingested into your DWH. The blue/red nodes are DBT models.
© 2022 - 2024 — McMap. All rights reserved.