Tutorial: Airflow + PySpark + dbt¶
You'll build a complete Analytics pipeline from scratch. By the end you'll have:
- Airflow scheduling and running your pipeline
- PySpark transforming raw sales data
- dbt creating clean analytical models
- Postgres storing everything
- pgAdmin and Grafana for visual inspection
The tutorial has 6 short steps. Each one adds one piece to the puzzle.
What you'll build¶
A sales data pipeline that:
- Extracts synthetic daily sales records
- Cleans and aggregates them with PySpark
- Creates a
sales_summarymart with dbt - Runs automatically via Airflow on a daily schedule
- Exposes results in Grafana dashboards
Prerequisites¶
- Python 3.12+
- pipx
- Docker Desktop running
Install DEGEN:
Steps¶
Init & Install
Scaffold the project and install dependencies.
Start Services
Launch Postgres, pgAdmin, Grafana, and Airflow.
Create the DAG
Write the Airflow DAG that orchestrates the pipeline.
PySpark Transform
Write the Spark job that cleans and loads the data.
dbt Models
Create staging and mart models with tests.
Run End-to-End
Trigger the DAG, verify results, open Grafana.