Catalog Checks: Columns#
Note
The below checks require both catalog.json
and manifest.json
to be present.
Classes:
Name | Description |
---|---|
CheckColumnDescriptionPopulated |
Columns must have a populated description. |
CheckColumnHasSpecifiedTest |
Columns that match the specified regexp pattern must have a specified test. |
CheckColumnNameCompliesToColumnType |
Columns with the specified regexp naming pattern must have data types that comply to the specified regexp pattern or list of data types. |
CheckColumnsAreAllDocumented |
All columns in a model should be included in the model's properties file, i.e. |
CheckColumnsAreDocumentedInPublicModels |
Columns should have a populated description in public models. |
CheckColumnDescriptionPopulated
#
Columns must have a populated description.
Receives at execution time:
Name | Type | Description |
---|---|---|
catalog_node |
Nodes
|
The CatalogNodes object to check. |
models |
List[DbtBouncerModelBase]
|
List of DbtBouncerModelBase objects parsed from |
Other Parameters (passed via config file):
Name | Type | Description |
---|---|---|
description |
Optional[str]
|
Description of what the check does and why it is implemented. |
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. |
severity |
Optional[Literal['error', 'warn']]
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/catalog/check_columns.py
CheckColumnHasSpecifiedTest
#
Columns that match the specified regexp pattern must have a specified test.
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 |
Nodes
|
The CatalogNodes object to check. |
tests |
List[DbtBouncerTestBase]
|
List of DbtBouncerTestBase objects parsed from |
Other Parameters (passed via config file):
Name | Type | Description |
---|---|---|
description |
Optional[str]
|
Description of what the check does and why it is implemented. |
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. |
severity |
Optional[Literal['error', 'warn']]
|
Severity level of the check. Default: |
Example(s):
catalog_checks:
- name: check_column_has_specified_test
column_name_pattern: ^is_.*
test_name: not_null
Source code in src/dbt_bouncer/checks/catalog/check_columns.py
CheckColumnNameCompliesToColumnType
#
Columns with the specified regexp naming pattern must have data types that comply to the specified regexp pattern or list of data types.
Note: Oe of type_pattern
or types
must be specified.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
column_name_pattern
|
str
|
Regex pattern to match the model name. |
required |
type_pattern
|
Optional[str]
|
Regex pattern to match the data types. |
required |
types
|
Optional[List[str]]
|
List of data types to check. |
required |
Receives at execution time:
Name | Type | Description |
---|---|---|
catalog_node |
Nodes
|
The CatalogNodes object to check. |
Other Parameters (passed via config file):
Name | Type | Description |
---|---|---|
description |
Optional[str]
|
Description of what the check does and why it is implemented. |
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. |
severity |
Optional[Literal['error', 'warn']]
|
Severity level of the check. Default: |
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
catalog_checks:
# No STRUCT data types permitted.
- name: check_column_name_complies_to_column_type
column_name_pattern: ^[a-z_]*$
type_pattern: ^(?!STRUCT)
Source code in src/dbt_bouncer/checks/catalog/check_columns.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
|
CheckColumnsAreAllDocumented
#
All columns in a model should be included in the model's properties file, i.e. .yml
file.
Receives at execution time:
Name | Type | Description |
---|---|---|
catalog_node |
Nodes
|
The CatalogNodes object to check. |
models |
List[DbtBouncerModelBase]
|
List of DbtBouncerModelBase objects parsed from |
Other Parameters (passed via config file):
Name | Type | Description |
---|---|---|
description |
Optional[str]
|
Description of what the check does and why it is implemented. |
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. |
severity |
Optional[Literal['error', 'warn']]
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/catalog/check_columns.py
CheckColumnsAreDocumentedInPublicModels
#
Columns should have a populated description in public models.
Receives at execution time:
Name | Type | Description |
---|---|---|
catalog_node |
Nodes
|
The CatalogNodes object to check. |
models |
List[DbtBouncerModelBase]
|
List of DbtBouncerModelBase objects parsed from |
Other Parameters (passed via config file):
Name | Type | Description |
---|---|---|
description |
Optional[str]
|
Description of what the check does and why it is implemented. |
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. |
severity |
Optional[Literal['error', 'warn']]
|
Severity level of the check. Default: |
Example(s):