/

Loading...
DataChonk generates comprehensive tests to ensure data quality.
Defined in YAML alongside your models:
models:
- name: dim_customers
columns:
- name: customer_id
tests:
- unique
- not_null
- name: email
tests:
- unique
- not_null
- name: status
tests:
- accepted_values:
values: ['active', 'inactive', 'churned']Verify foreign key integrity:
- name: customer_id
tests:
- relationships:
to: ref('dim_customers')
field: customer_idComplex logic in SQL files:
-- tests/assert_order_total_positive.sql
select *
from {{ ref('fct_orders') }}
where order_total < 0| Column Type | Recommended Tests |
|---|---|
| Primary Key | unique, not_null |
| Foreign Key | not_null, relationships |
| Status/Category | accepted_values |
| Amounts | dbt_expectations.expect_column_values_to_be_between |
| Dates | not_null, dbt_expectations.expect_column_values_to_be_in_type_list |
DataChonk includes dbt_expectations for advanced testing:
expect_column_values_to_be_betweenexpect_column_values_to_match_regexexpect_table_row_count_to_be_betweenexpect_column_distinct_count_to_equalsources:
- name: raw_ecommerce
freshness:
warn_after: {count: 12, period: hour}
error_after: {count: 24, period: hour}
tables:
- name: orders
loaded_at_field: _loaded_atRun freshness checks with: dbt source freshness