internalsGet Pro

Module 15 · Lesson 2 of 12Pro

dbt models, sources and references

Level
Beginner
Topic
Transformations with dbt
Reading time
14 min

When you finish this page you can

  1. Write a dbt model that reads other models with ref() and raw tables with source(), and predict the SQL each one compiles to in prod and in dev.
  2. Explain how dbt builds its dependency graph from those calls before it runs anything, and why a hard-coded table name breaks the build order.
  3. Declare raw tables in a sources file and set freshness limits on them.
  4. Decide which models may read sources, and why staging models are the only ones that do.

Builds on 3 lessons

Start with lesson 113 min
  1. dbt: transformations as version-controlled code13 min
  2. Design: a data model for an online store28 min
  3. Design: orchestrating a daily reporting pipeline28 min

Monday’s orders had no items

At 03:10 IST on Tuesday 8 February 2028, Meera is paged. The finance check says Monday’s 500,000 orders have item sales of ₹0. The order lines for the same day add up to about ₹60 crore.

Our biggest sale ever · Black Friday

Flat 50% Off

Pro

Continue reading

Unlock every course, now and later

  • System Design, live
  • AI Engineering, live
  • Data Engineering, live
  • Machine Learning Engineering, live
  • Inference Engineering, coming soon
  • AI Research, coming soon
  • Performance Engineering, coming soon
  • Agent & Harness Engineering, coming soon
  • LLM Fine-tuning, coming soon
  • LLM Pre-training & Post-training, coming soon
  • Reinforcement Learning, coming soon
  • AI Infrastructure & Platform Engineering, coming soon
  • AI Evaluation & Safety, coming soon
  • Forward Deployed Engineering, coming soon
  • Cloud Computing, coming soon
  • DevOps, coming soon

50% off · Annual and Lifetime

BLACKFRIDAY50Applied at checkout

Choose a plan