Search⌘ K
AI Features

Referencing Another Model

Explore how to use the ref() function in dbt to reference existing models, allowing you to build new models on top of them efficiently. Learn to write maintainable SQL that adapts to project changes while dbt manages model execution order. This lesson helps you master model dependencies for streamlined data pipelines.

We'll cover the following...

Selecting from a model

In dbt, referencing another model is a powerful feature that enables us to build new models on top of existing ones. By doing so, we can reuse the logic and calculations from the base model without duplicating code. This not only enhances code maintainability but also ensures that changes in the base model automatically propagate to the ...