This project implements a modern ELT data warehouse using BigQuery and dbt.
graph LR
subgraph Ingestion
Gen[Python Generator] -->|Writes CSVs| Raw[Raw Data(CSVs)]
end
subgraph BigQuery_ELT
Raw -->|Load (bq load)| Stg[Staging Views]
Stg -->|dbt (Clean)| WH[Warehouse (Facts/Dims)]
WH -->|dbt (Agg)| Marts[Data Marts]
end
classDef source fill:#e1f5fe,stroke:#01579b,stroke-width:2px;
classDef storage fill:#fff3e0,stroke:#e65100,stroke-width:2px;
classDef process fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px;
class Gen, Raw source;
class Stg, WH, Marts storage;
dbt_project/: Contains all dbt models, tests, and configuration.models/staging: Raw data cleaning and standardization.models/warehouse: Core Dimensional Models (Star Schema).models/marts: Aggregated Data Marts for BI.
ingestion/: Python scripts for data generation and ingestion.infrastructure/: Helper scripts for GCP resource setup.
pip install -r requirements.txtRun the data generator to create CSV files in ingestion/data/.
python ingestion/scripts/generate_data.pyEnsure you have a profiles.yml configured for your BigQuery project.
cd dbt_project
dbt deps
dbt buildInstead of manual scripts, use Terraform to manage GCP resources.
-
Navigate to the
terraformdirectory:cd terraform -
Initialize Terraform:
terraform init
-
Plan and Apply:
terraform plan -var="project_id=YOUR_PROJECT_ID" terraform apply -var="project_id=YOUR_PROJECT_ID"
- Partitioning:
fact_ordersis partitioned byorder_placed_at(Day). - Clustering:
fact_ordersis clustered byuser_idandstatus. - Dimensional Modeling: Users (Dim) and Orders (Fact) star schema.
