Catalog Checks
Note
The below checks require both catalog.json
and manifest.json
to be present.
check_catalog_sources
check_source_columns_are_all_documented
All columns in a source should be included in the source's properties file, i.e. .yml
file.
Receives:
Name | Type | Description |
---|---|---|
catalog_source |
DbtBouncerCatalogNode
|
The DbtBouncerCatalogNode object to check. |
exclude |
Optional[str]
|
Regex pattern to match the source path (i.e the .yml file where the source is configured). Source paths that match the pattern will not be checked. |
include |
Optional[str]
|
Regex pattern to match the source path (i.e the .yml file where the source is configured). Only source paths that match the pattern will be checked. |
Example(s):
Source code in src/dbt_bouncer/checks/catalog/check_catalog_sources.py
check_columns
check_column_name_complies_to_column_type
Columns with specified data types must comply to the specified regexp naming pattern.
Receives:
Name | Type | Description |
---|---|---|
catalog_node |
CatalogTable
|
The CatalogTable object to check. |
column_name_pattern |
None
|
(str): Regex pattern to match the model name. |
exclude |
Optional[str]
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
Optional[str]
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
Example(s):
catalog_checks:
# DATE columns must end with "_date"
- name: check_column_name_complies_to_column_type
column_name_pattern: .*_date$
types:
- DATE
catalog_checks:
# BOOLEAN columns must start with "is_"
- name: check_column_name_complies_to_column_type
column_name_pattern: ^is_.*
types:
- BOOLEAN
catalog_checks:
# Columns of all types must consist of lowercase letters and underscores. Note that the specified types depend on the underlying database.
- name: check_column_name_complies_to_column_type
column_name_pattern: ^[a-z_]*$
types:
- BIGINT
- BOOLEAN
- DATE
- DOUBLE
- INTEGER
- VARCHAR
Source code in src/dbt_bouncer/checks/catalog/check_columns.py
check_columns_are_all_documented
All columns in a model should be included in the model's properties file, i.e. .yml
file.
Receives:
Name | Type | Description |
---|---|---|
catalog_node |
CatalogTable
|
The CatalogTable object to check. |
exclude |
Optional[str]
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
Optional[str]
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
Example(s):
Source code in src/dbt_bouncer/checks/catalog/check_columns.py
check_columns_are_documented_in_public_models
Columns should have a populated description in public models.
Receives:
Name | Type | Description |
---|---|---|
catalog_node |
CatalogTable
|
The CatalogTable object to check. |
exclude |
Optional[str]
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
Optional[str]
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
Example(s):
Source code in src/dbt_bouncer/checks/catalog/check_columns.py
check_column_has_specified_test
Columns that match the specified regexp pattern must have a specified test.
Receives:
Name | Type | Description |
---|---|---|
catalog_node |
CatalogTable
|
The CatalogTable object to check. |
column_name_pattern |
str
|
Regex pattern to match the column name. |
exclude |
Optional[str]
|
Regex pattern to match the model path. Model paths that match the pattern will not be checked. |
include |
Optional[str]
|
Regex pattern to match the model path. Only model paths that match the pattern will be checked. |
test_name |
str
|
Name of the test to check for. |
Example(s):
catalog_checks:
- name: check_column_has_specified_test
column_name_pattern: ^is_.*
test_name: not_null