Keep raw data in bronze and a silver bug becomes fixable: one replay took gold revenue to $1,200,704.
python3 --version.pip install "duckdb>=1.0"git clone https://github.com/DayanEbrar0X/data-anatomy.ai.git cd data-anatomy.ai
python3 -m venv .venv source .venv/bin/activate
pip install -r requirements.txt # or just this lesson: pip install "duckdb>=1.0"
cd data-engineering/20-medallion-architecture python3 scripts/make_events.py cd src python3 medallion.py
import duckdb
from medallion import bronze, silver, gold
from layers import report
db = duckdb.connect()
bronze(db) # raw events, kept untouched
silver(db, "amount"); gold(db); report(db, "v1")
silver(db, "ltrim(amount, '$')"); gold(db)
report(db, "v2") # the fix, replayed from bronzeEvery serious data platform has three layers. Here's why. Bronze keeps raw data. Silver cleans it.
Gold answers the business. 10,000 messy order events land in bronze, untouched. Version one cleans into silver and gold, but can't read dollar amounts. Fix one expression, and replay from the same bronze.
Version one dropped 3,713 rows. Revenue, 804 thousand. Replayed: only 580 dropped, and revenue is 1.2 million.
Land it raw, clean it once, and you can always replay.
Read the lesson on GitHub →