Tests#
Note
The below checks require catalog.json to be present.
Checks related to column tests.
Functions:
| Name | Description |
|---|---|
check_column_has_specified_test |
Columns that match the specified regexp pattern must have a specified test. |
check_column_has_specified_test
#
Columns that match the specified regexp pattern must have a specified test.
Rationale
Naming conventions communicate expectations: a column named is_active implies it is boolean and never null; a column ending in _id implies it is a valid foreign key. Without enforcement, these implicit contracts go untested, and referential integrity issues or null values can silently corrupt downstream aggregations. This check bridges naming conventions and data quality by automatically requiring specific tests on columns that match a pattern, eliminating the manual overhead of reviewing every column individually.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
column_name_pattern
|
str
|
Regex pattern to match the column name. |
required |
test_name
|
str
|
Name of the test to check for. |
required |
Receives at execution time:
| Name | Type | Description |
|---|---|---|
catalog_node |
CatalogNodeEntry
|
The CatalogNodeEntry object to check. |
tests |
list[TestNode]
|
List of TestNode objects parsed from |
Other Parameters (passed via config file):
| Name | Type | Description |
|---|---|---|
description |
str | None
|
Description of what the check does and why it is implemented. |
exclude |
str | None
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
str | None
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
severity |
Literal[error, warn] | None
|
Severity level of the check. Default: |
Example(s):
catalog_checks:
- name: check_column_has_specified_test
column_name_pattern: ^is_.*
test_name: not_null