Favorita: dbt Staging Models
The staging layer that turns raw Favorita tables into clean, typed, consistently named models — sales, stores, transactions, oil prices, holidays, and a date spine. The unglamorous foundation everything else stands on.
Primary Outcome
A clean, typed staging layer that standardizes raw retail tables into reliable building blocks.
Solution
A staging layer with one clean, tested model per source plus a date spine, giving every downstream model consistent, reliable inputs.
Deliverables
Staging models for sales, stores, transactions, oil, holidays, and train/test splits
A date-spine model for continuous calendar coverage
Source definitions and a
schema.ymlwith column testsAn incremental staging macro for efficient rebuilds
Strategic Context
Skipping a real staging layer is the most common reason warehouses become untrustworthy. One clean, tested model per source is cheap insurance against the data-quality bugs that surface months later in a forecast nobody can explain.
Technical Architecture
Skipping a real staging layer is the most common reason warehouses become untrustworthy. One clean, tested model per source is cheap insurance against the data-quality bugs that surface months later in a forecast nobody can explain.
Problem Statement
Raw tables arrive with inconsistent names, mixed types, and calendar gaps, so every downstream model re-solves the same cleaning problems.
Links
What's Included
The dbt/models/staging directory: stg_favorita_* models, stg_vertex_* models for ML metadata, schema.yml tests, and the staging_incremental macro.
FAQs
Why a separate staging layer?
It isolates source-specific cleaning so business logic downstream stays simple and portable if a source changes.
What's the date spine for?
To guarantee a continuous calendar so missing days in transactional data don't silently break joins or forecasts.
Tech Stack
Tool 1
Tool 4
Tool 4
Tool 3
Tool 2
Tool 4
Primary Outcome
A clean, typed staging layer that standardizes raw retail tables into reliable building blocks.
Problem Statement
Raw tables arrive with inconsistent names, mixed types, and calendar gaps, so every downstream model re-solves the same cleaning problems.
Solution
A staging layer with one clean, tested model per source plus a date spine, giving every downstream model consistent, reliable inputs.
Links
Deliverables
Staging models for sales, stores, transactions, oil, holidays, and train/test splits
A date-spine model for continuous calendar coverage
Source definitions and a
schema.ymlwith column testsAn incremental staging macro for efficient rebuilds
What's Included
The dbt/models/staging directory: stg_favorita_* models, stg_vertex_* models for ML metadata, schema.yml tests, and the staging_incremental macro.
Strategic Context
Skipping a real staging layer is the most common reason warehouses become untrustworthy. One clean, tested model per source is cheap insurance against the data-quality bugs that surface months later in a forecast nobody can explain.
FAQs
Why a separate staging layer?
It isolates source-specific cleaning so business logic downstream stays simple and portable if a source changes.
What's the date spine for?
To guarantee a continuous calendar so missing days in transactional data don't silently break joins or forecasts.
Technical Architecture
Skipping a real staging layer is the most common reason warehouses become untrustworthy. One clean, tested model per source is cheap insurance against the data-quality bugs that surface months later in a forecast nobody can explain.
Tech Stack
Tool 1
Tool 4
Tool 4
Tool 3
Tool 2
Tool 4