Module 2 — dbt Basics

The core dbt mental model. Start by seeding data so the practicums have something to chew on, then work through refs, CTEs, materializations, Jinja, macros, and project structure.

This module covers the dbt concepts that differ from raw SQL — refs, the DAG, CTEs, materializations, Jinja, macros, and packages. Each lesson includes hands-on practice against the Doe family seed data you load in lesson 2.1.

Prerequisite: Module 1 — Setting Up dbt — you need a working dbt project on BigQuery.

Why seeds come first

You don't have ingested Gmail / Calendar / Notion data yet (that's a Module 3 prereq). Seeds are the shortcut — a CSV in your project that dbt loads into the warehouse. With the family_members seed in place, every concept in this module gets a real, hands-on practicum instead of hypothetical SQL.

What you'll learn

  • How to load CSV reference data into the warehouse via dbt seed
  • The dbt mental model: models, ref() and source(), the DAG, and lineage
  • How to structure dbt models with CTEs — the import → logic → final pattern almost every nexus model uses
  • Materializations — view, table, incremental, ephemeral
  • Jinja and programmatic SQL — how dbt makes SQL programmable
  • Macros and packages — reusable Jinja and how to install third-party packages like dbt_utils and dbt-nexus
  • The standard dbt project layout
  • How to build a real model end-to-end against a public BigQuery dataset

Lessons

  1. Seeding the Doe family data — load family_members.csv so the rest of the module has data to query
  2. Creating models, refs, and lineage — the dbt mental model and the DAG
  3. CTEs — the building blocks of dbt models — the import → logic → final pattern
  4. Materializationsview, table, incremental, ephemeral
  5. Jinja and programmatic SQL — control flow, loops, compile-time SQL generation
  6. Macros and packages — reusable Jinja and the package ecosystem
  7. The Doe family project structure — directories, dbt_project.yml, layered model conventions
  8. Examples and practicum — three worked examples plus a consolidated end-to-end practicum

When you're done

You'll be comfortable with every dbt feature you need to read and write nexus models, and you'll have a project structured the way nexus expects. On to Module 3 — Setting Up dbt-nexus.

Start with 2.1 Seeding the Doe family data.