Favorita: dbt Data Tests

Four singular dbt tests that catch the failures that actually break forecasts: broken date continuity, train/test leakage, row-count drift, and sales that don't reconcile. The assertions that let you trust a pipeline you didn't watch run.

Primary Outcome

A set of data-integrity tests that fail the build before bad data reaches a model or dashboard.

Solution

Four singular dbt tests that encode the things that must be true about the data and fail the build the moment they aren't.

Deliverables

  • assert_date_spine_continuous — no gaps in the calendar

  • assert_train_test_date_boundary — no leakage across the split

  • assert_sales_fct_row_count — row counts stay in expected range

  • assert_company_sales_reconcile — aggregates reconcile to source

Strategic Context

Generic tests check structure; they don't know your domain. The tests that matter encode the specific things that must be true about your data — no leakage, no gaps, reconciled totals. Writing them down is how data quality becomes a guarantee instead of a hope.

Technical Architecture

Generic tests check structure; they don't know your domain. The tests that matter encode the specific things that must be true about your data — no leakage, no gaps, reconciled totals. Writing them down is how data quality becomes a guarantee instead of a hope.

Problem Statement

Schema tests pass while domain-specific failures — date gaps, train/test leakage, unreconciled totals — slip through and quietly corrupt forecasts.

Links

What's Included

The dbt/tests directory: four singular SQL tests covering date continuity, train/test boundaries, row-count bounds, and sales reconciliation.

FAQs

How are these different from schema tests?

Schema tests check structure (unique, not_null). These check domain truths — leakage, continuity, reconciliation — written as SQL.

Do they slow the build much?

Marginally. The cost is trivial next to shipping a forecast built on broken data.

Tech Stack

Tool 1

Tool 4

Tool 4

Tool 3

Tool 2

Tool 4

Primary Outcome

A set of data-integrity tests that fail the build before bad data reaches a model or dashboard.

Problem Statement

Schema tests pass while domain-specific failures — date gaps, train/test leakage, unreconciled totals — slip through and quietly corrupt forecasts.

Solution

Four singular dbt tests that encode the things that must be true about the data and fail the build the moment they aren't.

Links

Deliverables

  • assert_date_spine_continuous — no gaps in the calendar

  • assert_train_test_date_boundary — no leakage across the split

  • assert_sales_fct_row_count — row counts stay in expected range

  • assert_company_sales_reconcile — aggregates reconcile to source

What's Included

The dbt/tests directory: four singular SQL tests covering date continuity, train/test boundaries, row-count bounds, and sales reconciliation.

Strategic Context

Generic tests check structure; they don't know your domain. The tests that matter encode the specific things that must be true about your data — no leakage, no gaps, reconciled totals. Writing them down is how data quality becomes a guarantee instead of a hope.

FAQs

How are these different from schema tests?

Schema tests check structure (unique, not_null). These check domain truths — leakage, continuity, reconciliation — written as SQL.

Do they slow the build much?

Marginally. The cost is trivial next to shipping a forecast built on broken data.

Technical Architecture

Generic tests check structure; they don't know your domain. The tests that matter encode the specific things that must be true about your data — no leakage, no gaps, reconciled totals. Writing them down is how data quality becomes a guarantee instead of a hope.

Tech Stack

Tool 1

Tool 4

Tool 4

Tool 3

Tool 2

Tool 4