For the complete documentation index, see llms.txt. This page is also available as Markdown.

Quality

Quality overview: how assertions, DQ checks, and unit tests work together to keep models trustworthy, and when to use each.

Use Assertions, Data Quality checks, and Unit Tests together to keep a model trustworthy.

Three tools, three jobs. Unit tests catch logic bugs in your transformations before they run anywhere. Assertions block bad rows at write time. Data Quality checks watch for trends without blocking the pipeline.


The three-layer quality strategy

When to use each:

Tool
Purpose
Blocks pipeline?
Best for

Critical validation

Yes (always)

Business rules, data integrity

Quality monitoring

No

Trends, drift, monitoring

Logic validation

No

SQL correctness, edge cases

The key difference: assertions stop everything if they fail. Data quality checks and tests warn you, so you can investigate without blocking production.


How they work together

Execution order:

  1. Unit Tests run during development to validate logic, catching bugs before deployment.

  2. Plan applies changes to the environment.

  3. Model executes the transformation.

  4. Assertions run immediately and block the run on failure.

  5. Data Quality checks run after a successful run or plan apply to track quality over time, without blocking.

Unit tests run first against fixtures. Assertions run with the model and stop the run on failure. Data Quality checks run after the models build successfully to track quality over time. Each layer catches what the previous one isn't designed to.


Running quality tools


Best practices

Do

  1. Start with assertions. Add critical blocking validations first, before worrying about trends.

  2. Add data quality checks gradually: monitor trends first, then tighten thresholds as you learn what's normal.

  3. Test during development, before deploying.

  4. Use descriptive names, like revenue_mismatch_with_raw instead of check_1.

  5. Order assertions efficiently: fast checks first, slow checks last.

Don't

  1. Don't use data quality checks for critical rules. If it's critical, it should block: use an assertion.

  2. Don't skip assertion failures. Fix the root cause.

  3. Don't over-audit. Focus on critical business rules.

  4. Don't ignore data quality trends. Consistently failing checks signal a real problem.


Choose a page

  • Unit Tests - validate model logic with controlled inputs and expected outputs.

  • Assertions - attach audits to models to block bad data at runtime.

  • Data Quality - attach expectation-based checks that monitor datasets over time.

Last updated

Was this helpful?