Week 22: Exercises & Checklist
Graded exercises
Easy: Run
notebooks/01-pyspark-data-engineering.ipynbto completion. It prints the final on-time rate and amatch: True/Falsecomparing the PySpark aggregation against the SQL version. Record both in the Week 22 tracker sheet.Standard: In
01-pyspark-data-engineering.ipynb, add a window function that ranks carriers by on-time rate within each month. Identify the most-improved and the most-declined carrier across consecutive months, and write one sentence hypothesizing why (join incarrier_nameandregion).Stretch: In
02-streaming-and-dlt-pipeline.ipynb, add a third expectation on the silver materialized view, e.g.@dp.expect_or_fail("non_negative_delay", "delay_hours >= 0"), re-run the pipeline, and describe (in a markdown cell) what happens to the update when the constraint is violated, versus a@dp.expect_or_drop.Portfolio: Advance the ZoroLogistics streaming pipeline milestone: wrap the pipeline in a scheduled Lakeflow Job (task type Pipeline, run-if
ALL_SUCCESS), and capture the pipeline DAG screenshot plus your monitoring query for the portfolio.
Hints
- Easy: Run notebook 01 top to bottom; the numbers to record are in the final cell (
final on-time rateandenriched rows), andmatch: True/Falseis the cross-check cell just before it. IfmatchisFalse, diff your PySparkaggagainst the SQLCASE. - Standard: The window already exists (
rank_in_month); to find the most-improved/declined carrier, join each month'srank_in_month = 1to the prior month's oncarrier_idand diffon_time_rate. - Stretch: Add the
@dp.expect_or_faildecorator above the others onsilver, drop adelay_hours < 0row intoevents/, and re-run. Contrast:expect_or_failaborts the update;expect_or_dropwould have removed the row and continued. - Portfolio: A Lakeflow Job's Pipeline task type wraps the pipeline; set the run-if to
ALL_SUCCESSon any downstream task, and capture both the DAG screenshot and thesystem.lakeflow.jobsmonitoring query.
Checklist (mirrors manifest.json + Excel tracker)
- [ ] Mon: PySpark lab: transform shipment data with DataFrames; compare with SQL.
- [ ] Tue: Write a DLT pipeline in Python (or SQL) with expectations on data quality.
- [ ] Wed: Add a streaming table for live shipment events (Auto Loader/streaming source).
- [ ] Thu: Create a Lakeflow Job: schedule and orchestrate the pipeline; check runs and lineage.
- [ ] Fri: Use case: the streaming KPI pipeline passes quality gates; publish a monitoring query.
- [ ] Sat: Take the Week 22 quiz (quiz.md), pass with 8/10; record the score in Notes.
- [ ] Milestone: Update the Excel tracker; commit the pipeline code.