
Kick off the 2025 mastering dbt course with a hands-on introduction to building a dbt project from scratch, documenting and testing SQL models, and leveraging macros and jinja.
Trace the data stack's evolution from raw data and manual metrics to data warehouses and automated pipelines, highlighting shared metrics, run order, data quality, and documentation challenges.
Understand how dbt uses yaml documentation to test sql data models, describing columns and constraints, and generate a docs site that shows model lineage and upstream and downstream relationships.
Slight correction here at 4:30 - it should be all_values_equal_to, not test_all_values_equal_to!
Discover how dbt reduces data stack pain by inferring model run order, simplifying documentation and testing, and enabling python-like functionality with ginger for richer sql workflows.
See how dbt fits the transform step in the ELT data stack, managing dependencies, templated SQL with Jinja, and automated testing and documentation for databases like BigQuery and Snowflake.
Compare dbt core and dbt cloud, highlighting core’s CLI-based development with databases like Redshift, Snowflakes, and BigQuery, and cloud’s web editor and job scheduling, with the course focus on core.
Set up your dbt workflow with Google BigQuery, Python, Visual Studio Code, and GitHub, establishing required Gmail accounts and tools to build projects.
Update this course to reflect new dbt versions, rerecording only when significant changes occur, and keep older content relevant to newer releases.
Create a Gmail account by navigating to accounts.google.com/sign up, entering required details, reviewing terms, and clicking agree.
Set up a Google BigQuery project with a free trial, learn on-demand analysis, and understand the first terabyte free and pay-per-use billing.
Resolve BigQuery billing issues by adding and verifying a billing account in console.cloud.google.com, link it to your project, and upgrade the billing banner.
Master the BigQuery UI by setting up a billing project, using the public look e-commerce dataset, and running sample SQL queries in the editor within the free tier.
Create a GitHub account to store and version control your dbt projects, enabling collaboration and remote backups. In the next video, pull code from the remote repository.
Compare forking and cloning on GitHub, and learn how forking your own copy lets you push changes while cloning only pulls to your computer.
Fork the tutorial course repository on GitHub and clone the fork locally using VS Code to start working. Then install the recommended extensions to complete the setup.
Install the recommended VSCode extensions for dbt, clicking install on three of four and awaiting the fourth before enabling, including syntax highlighting, a non-version-controlled add-on, and yaml formatting.
Create and activate a virtual environment on macOS, Windows, or Git Bash, then install required Python packages from a requirements.txt file to standardize your workspace.
Set up dbt for BigQuery by auto-activating a Python virtual environment and configuring gcloud authentication to run dbt commands against BigQuery.
Commands used:
dbt init
dbt debug --config-dir
Set up the dbt power user extension and configure the profiles directory and profiles.yaml for your system. Preview and run compiled sql to inspect downstream and upstream models.
Structure a dbt project with staging, intermediate, and marks folders, using one source per staging table, clean yaml separation, and naming conventions like stg_<source>__<table> and dim or fct tables.
Create a model YAML file for your data model using the codegen macro and dash run to generate a template, with model_names and a stage e-commerce orders example.
Configure dbt to materialize models as tables by default using yaml, resource paths, and project-wide settings. Compare table and view behavior in BigQuery and per-file overrides.
Create and configure the orders.yaml dbt model file, align the file name with the model, adjust for advanced parts, and run tests to verify integration with BigQuery.
Set default test severity to one under the tests tab in the lessons project, under the models tab, and set expiration to 168 hours (seven days) to avoid stale tables.
Configure dbt tests by setting severity to warn or error, and see how the pipeline reacts to each setting while validating data quality on the stage ecommerce products model.
Learn to use dbt_utils and dbt_expectations to validate cost and retail price in stage e-commerce products, adding min zero constraints, expression true checks, and named tests for clear feedback.
Discover how to create custom singular tests in dbt using SQL checks that return rows to flag data mismatches, like order item counts versus orders, with configurable severity.
Explore building custom generic tests in dbt by creating a generic folder, defining a primary key test in yaml, and using jinja templating for not null and unique validations.
discover how to use seeds, version controlled csv files, to load new data into your warehouse with dbt; create seeds and seeds.yaml, validate column types, and load before downstream runs.
Master incremental models in dbt by building tables with new rows only, using the incremental macro, drop and replace behavior, a unique key, and full refresh or schema changes.
Explore micro-batch incremental models in dbt, replacing whole partitions by day/month/year, enabling selective backfills and reruns of specific data from event time, with begin, batch size, and event time configuration.
Explore data model governance in dbt, covering model access, model contracts, and model versions to enable scalable dbt projects and safer, controlled releases.
discover how data contracts advance model governance by enforcing that every column has a defined data type and constraints, checked before model creation via YAML in dbt.
learn to run dbt with multiple profiles by using target flags and a profiles.yaml in a profiles directory, directing the same project to dev, testing, or production, including cloud setups.
Explore the dbt empty flag that runs SQL without processing data, creating empty tables to test code quickly and cheaply while verifying SQL behavior.
Learn the three macro types in dbt: functions, hooks, and operations, and how to build reusable sql logic with is weekend macros, before and after run hooks, and run operations.
Explore built-in dbt jinja functions and learn how to leverage adapter.get_columns_in_relation to list model columns. Use dbt_utils.get_column_values to fetch distinct column values, such as order status, from existing tables.
Discover how hooks operate before and after models and runs in dbt, using macros to create reusable functions and orchestrate pre and post run actions.
Explore jinja statements for for loops and set variables to pivot column data by department in SQL. Learn to build dynamic, department-based total sold columns using the get_columns utility.
This section focuses on everything to do with dbt Cloud. In this section we will:
Create a dbt Cloud account
Configure dbt Cloud to connect to our dbt project
Understand how to use the dbt Cloud IDE (think of it as being a web version of VSCode)
Deploy (schedule) our dbt project as a pipeline on dbt Cloud
Create and configure a service account in BigQuery, generate a JSON key, and upload it to dbt to enable credentials for running jobs and testing the connection.
Explore configuring a project, managing branches, viewing lineage, running and testing models, and using pre-configured commands in the dbt cloud ide.
Deploy dbt Cloud pipelines by creating production deployments, configuring environments, and scheduling jobs with source freshness and docs generate and docs serve, while managing credentials and BigQuery permissions.
A complete course to help anyone with basic SQL skills learn advanced dbt, a key tool for Analytics Engineering!
Welcome to the 2025 Mastering dbt (data build tool) course! This course runs through everything from the theory behind dbt to building an advanced dbt project (from scratch) and deploying it on dbt Cloud.
I have over 9 years of experience across Analytics / Analytics Engineering / Data Science, including 5 years using dbt on a daily basis. I was also involved in the rollout of dbt in my time at Monzo Bank!
In this course I've taken everything I've learnt over the past 5 years, and what I use on a daily basis, and condensed it to take anyone who knows SQL to an advanced level of dbt as quickly as possible.
MY APPROACH TO THIS COURSE:
We'll cover everything you need to know about dbt: from the basic data modelling right through to all of the advanced features such as creating custom tests and macros. We'll be doing this step by step, and build from the basics upwards.
It's focused on practical outcomes - we won't be spending ages on database theory, or going into lots of detail on the eCommerce dataset we'll be using, instead we'll be aiming to get you up to advanced dbt levels as quickly as possible.
For every video where we're writing code, I've created lesson attachments with the final outputs. This means you can either code as you go along, or watch the videos and look at the handouts afterwards! I've also included some theory with these handouts to help hammer home the points made in the videos.
There's also a public GitHub repository (which you'll be using for this course) that contains a model final project you can reference throughout.
This course isn't static! I'd love to hear your feedback and will be updating this course on an ongoing basis.
COURSE STRUCTURE:
This course focuses on first getting a good understanding of what problems dbt solves, then building a basic dbt project, before layering on more advanced concepts and finally deploying our project with dbt Cloud.
Introduction
Some theory (<1 hour) around dbt, what problems existed in the data stack before it came along, and how it solves them.
Tool setup
Getting set up with Python, GitHub, Google BigQuery, VSCode, and of course dbt! If you're familiar with any of these tools already then you are more than welcome to skip the appropriate lessons.
We'll also be exploring the fictional eCommerce dataset that we'll be using throughout the course.
Building our basic dbt project
This section focuses on creating our project from scratch, including how we will structure our project.
We'll be building out staging (stg), intermediate (int), and mart data models, including documentation & testing with the out-of-the-box dbt tests.
Advanced dbt testing
We'll start to build on our basic dbt project by setting test severity & thresholds, using the dbt-utils and dbt-expectations external packages for their excellent selection of tests, creating our own custom singular & generic tests, unit testing, and testing the freshness of our source data.
Advanced data modelling with dbt
Next, we'll be looking at how we can create reusable documentation, seed files (version controlled .csv files), snapshots (capturing changes to data tables), and materialisation methods.
Most of this section will be focused on the last part - the materialisation methods: ephemeral, view, table, and incremental (including microbatch). By this point we'll have encountered view & table models and we will be building both an incremental and an ephemeral model - and you will gain an understanding of what to use and when.
This section includes all model governance features from dbt version 1.5! This includes model access, groups, contracts, and versions.
Advanced dbt commands
This section will focus less on changing our dbt project, but instead all of the major dbt commands and how (and when) to use them.
Advanced Jinja & macros
The final changes to our project will involve using Jinja - a core feature of dbt and arguably it's most complex but powerful feature - and using it to create our own macros.
This section will run through how you can use Jinja macros for hooks, operations, and as reusable functions in your SQL models. It'll also run through some theory around Jinja, common mistakes, and what I (personally) find to be what it's most useful for!
dbt Cloud
Finally, we'll be exploring how to take our project and deploy it on dbt Cloud - including how to schedule it to run on a regular basis. We'll also be looking at dbt Cloud itself and its main benefits.