A hands-on dbt training project using the Olist Brazilian E-commerce dataset.
Repo: https://github.com/cbfacademy/Introduction-to-DBT
-
Clone this repo:
git clone https://github.com/cbfacademy/Introduction-to-DBT.git cd Introduction-to-DBT -
Follow Lab 1 instructions in
labs/lab_01_setup/README.md -
Work through each lab in order — each lab folder contains:
- A
README.mdwith step-by-step instructions - The actual
.sqland.ymlfiles to copy into the correct locations
- A
| Lab | Folder | What You'll Build |
|---|---|---|
| 1 | labs/lab_01_setup/ |
BigQuery + dbt setup and connection |
| 2 | labs/lab_02_source_ref/ |
Staging models, sources, ref(), materializations |
| 3 | labs/lab_03_jinja_macros/ |
Jinja loops, custom macros, dbt packages |
| 4 | labs/lab_04_marts_testing/ |
Dimension/fact tables, schema & singular tests |
| 5 | labs/lab_05_docs_freshness/ |
Documentation, source freshness |
Each lab folder has the SQL/YAML files you need. You can either:
- Follow the README and type/paste the code yourself (recommended for learning)
- Copy the files from the lab folder to the correct location, e.g.:
cp labs/lab_02_source_ref/stg_orders.sql models/staging/
models/
├── staging/ # Clean raw data (views)
│ ├── _sources.yml
│ ├── _staging.yml
│ ├── stg_orders.sql
│ ├── stg_customers.sql
│ ├── stg_order_items.sql
│ ├── stg_products.sql
│ └── stg_product_categories.sql
├── intermediate/ # Business logic (views)
│ ├── int_orders_enriched.sql
│ ├── int_order_items_enriched.sql
│ └── int_orders_by_status.sql
└── marts/ # Final tables for BI
├── _marts.yml
├── dim_customers.sql
├── fct_orders.sql
└── fct_daily_revenue.sql
macros/
├── limit_in_dev.sql
└── cents_to_currency.sql
tests/
├── assert_positive_prices.sql
└── assert_orders_have_items.sql
The data/ folder contains 5 CSV files from the Olist dataset:
| Table | Rows |
|---|---|
| customers | 10,000 |
| orders | 10,000 |
| order_items | 11,253 |
| products | 6,124 |
| product_category_name_translation | 71 |
- Python 3.8+
- Google Cloud account with BigQuery enabled
- dbt-bigquery (
pip install dbt-bigquery)