Skip to content

Commit d938c8c

Browse files
Lasse Benningaclaude
andcommitted
fix(week10): correct WARN-severity guidance and add INNER JOIN hint
Two student-facing fixes found by building the assignment against live Azure Postgres: - Singular-test stub claimed severity is "set in dbt_project.yml". The template ships no dbt_project.yml (students dbt init their own), and a project-level severity would silently downgrade the not_null / unique_combination PK tests. Point students at an inline {{ config(severity='warn') }} instead. - Mart stub said only "join trips to zones". A pickup_location_id with no matching zone (e.g. 999) becomes NULL borough under a LEFT JOIN and fails the not_null PK test. Tell students to INNER JOIN so pickup_borough stays non-null and the mart lands at the rubric's 184 rows. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PLwBsooLgWEkUqJYVK7FsU
1 parent a7328bb commit d938c8c

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

models/marts/fct_daily_borough_stats.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ zones AS (
1414
)
1515

1616
SELECT
17-
-- TODO: join trips to zones on pickup_location_id = location_id
17+
-- TODO: join trips to zones on pickup_location_id = location_id.
18+
-- Use an INNER JOIN: a few trips have a pickup_location_id with no matching
19+
-- zone (e.g. 999). INNER JOIN drops those so pickup_borough is never NULL and
20+
-- can serve as part of the mart's primary key (your not_null test needs this).
1821
-- TODO: aggregate to grain (pickup_borough, pickup_date)
1922
-- Required output columns:
2023
-- pickup_borough TEXT - z.borough

tests/assert_avg_tip_pct_within_bounds.sql

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@
33
-- which is unusual and almost always indicates a small-sample bucket (e.g. the
44
-- Unknown borough) where a few high-tip outliers dominate the average.
55
--
6-
-- This test is intentionally set to WARN severity in dbt_project.yml so it
7-
-- does not block the build, but it surfaces the anomaly for the reports/answers.md
8-
-- write-up. The assignment rubric requires documenting this finding.
6+
-- Set this test to WARN severity by adding an inline config at the top of this
7+
-- file (below these comments): {{ config(severity='warn') }}
8+
-- That keeps a few expected Unknown-borough rows from blocking `dbt build`, while
9+
-- still surfacing them for your reports/answers.md write-up (the rubric requires
10+
-- documenting this finding). Do NOT set a project-level test severity in
11+
-- dbt_project.yml: that would also downgrade your not_null and
12+
-- unique_combination primary-key tests, which you want to stay at ERROR.
913
--
10-
-- The test passes when zero rows are returned; any returned rows are flagged.
14+
-- The test passes (no WARN) when zero rows are returned; any returned rows are flagged.
1115

1216
-- TODO: write the SELECT here.
1317
-- Query {{ ref('fct_daily_borough_stats') }} and return rows where avg_tip_pct > 1.

0 commit comments

Comments
 (0)