dbt Fundamentals
Back to dbt Foundations: What and Why

ref() and Lineage — How dbt Wires the DAG

The single most important dbt function. How ref() builds the DAG, what it resolves to, and why hardcoded table names are a sin. FIND_VIDEO: search 'dbt ref function DAG lineage' — recommended channel: dbt Labs. Aim for 10 min or under.

3 minutesVideo LessonPDF notes
🎯 Free Guest Mode: You are learning for free. Sign in to save your completion progress and quiz answers.
Loading progress...

Key moments

  1. Generating Project Documentation — Compile project metadata and launch the local documentation web server using CLI commands.
  2. Accessing Lineage Graph — Open the visual Directed Acyclic Graph inside the documentation interface.
  3. Filtering Lineage Nodes — Isolate models and seeds across upstream and downstream paths using resource filters.
  4. Value of Lineage — Evaluate pipeline impact and troubleshoot warehouse dependencies across transformation stages.
PDF notes

Frequently asked questions

How does dbt know which model runs first?

dbt parses every `ref()` macro in your SQL files to build a Directed Acyclic Graph (DAG) that dictates execution order.

Why does my lineage graph look outdated after editing a model?

The lineage graph reads static JSON files generated during compilation, so you must re-run `dbt docs generate` to see changes.

What node types appear in the dbt lineage graph?

The DAG displays sources, seeds, staging models, intermediate models, marts, and schema tests as distinct connected nodes.

How was this lesson?

Your feedback helps us refine explanations and catch bugs.