One bad write: the lake breaks, the warehouse and the lakehouse reject it and both answer $74.50.
python3 --version.pip install "pyarrow>=18"pip install "duckdb>=1.0"pip install "pyiceberg[pyarrow,sql-sqlite]>=0.12"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 "pyarrow>=18" "duckdb>=1.0" "pyiceberg[pyarrow,sql-sqlite]>=0.12"
cd data-engineering/24-lake-vs-warehouse-vs-lakehouse cd src python3 three_ways.py
import duckdb
from ways import lake, warehouse, lakehouse
for way in (lake, warehouse, lakehouse):
name = way.__name__
try:
usd = way().fetchone()[0]
print(f"{name}: revenue ${usd:.2f}")
except duckdb.Error:
print(f"{name}: query failed")Three names for where the data lives, and they're not the same. Lake, warehouse, lakehouse. Same six events, plus one bad write: an amount typed as text. One loop asks each store for total revenue.
Run it. The lake took the bad file, then its query failed. The warehouse rejected the bad rows: 74.50.
The lakehouse rejected them too, on open Parquet files, with two commits. Check on read. Check on write. Or check on write, over open files.
Read the lesson on GitHub →