BookNest's Daily Pipeline

BookNest's Daily Pipeline, End to End

BookNest's daily pipeline turns one UTC day ds of orders into published sales figures in five idempotent steps: extract the day's orders from the order service's JSON Lines export (JSON, Columnar and Binary Formats's sample data) into landing/orders/date=ds/; load them into the shop tables orders and order_items, replacing the day in one transaction; transform with dbt 37,942 build --select fct_sales (Analytical SQL and Data Warehouses's incremental model and its tests); check that the day's lines and amounts in analytics.fct_sales equal the source's; and publish the day's genre totals by upsert into mart.daily_genre_sales.

The steps are plain functions in demos/ch07/pipeline/booknest_pipeline.py, reused by every orchestrator later. setup.sh holds back 28-30 June 2026; run_day.sh then calls the five steps, twice for 28 June:

Output of 3
$ bash run_day.sh 2026-06-28
extract  2026-06-28: 186 orders -> landing/orders/date=2026-06-28/orders.jsonl
load     2026-06-28: 186 orders, 269 lines replaced
dbt      fct_sales built and tested
check    2026-06-28: 269 lines, gross 6855.25 match the source
publish  2026-06-28: 6 genre rows upserted
$ bash run_day.sh 2026-06-28
...
check    2026-06-28: 269 lines, gross 6855.25 match the source

The second run changes nothing. What the script cannot do is run at 02:00, retry dbt after a database restart, run 29 and 30 June in order, show last night's failure or alert anyone: an orchestrator's jobs.