Course overview/Make failure loud1 of 3
Checks as automated audit
Checks as automated audit
Turn audit questions about grain and reconciliation into blocking Bruin checks.
Make the audit executable
A check is an audit question recorded in the asset. Built-in checks such as not_null, unique, relationships, accepted_values, positive, non_negative, min, max, freshness, and row_count cover common assumptions. A custom check returns a count or value, so you can test less common rules too. A blocking check stops the run when its rule fails.
The shipped reporting table has simple column checks but lacks a one-row-per-key check and a source comparison. Add checks for assumptions that can break the metric. More generic checks only add noise; a useful check names the failure it catches.
Your task
Add a grain custom check and a source-reconciliation custom check to pipeline/assets/mart/weekly_category_revenue.sql. Run bruin validate pipeline and bruin run --only checks pipeline, recording the check names and results in docs/checks.md.
Check your understanding
- Which check tests a claimed one-row-per-key grain?
- What does a blocking check do?
- Why is reconciliation valuable?
Do it with your agent
Say next lesson, add the two checks yourself, then say review my work.
Rubric
- The grain check groups by
iso_week, category_nameand expects duplicate-group count0. - The reconciliation check compares weekly mart revenue to filtered
fct_order_linesrevenue and expects difference0. -
bruin validatepasses and the two new checks run as blocking checks.