Columns#
Note
The below checks require manifest.json to be present.
Checks related to model column definitions, types, and constraints.
Functions:
| Name | Description |
|---|---|
check_model_columns_have_relationship_tests |
Columns matching a regex pattern must have a |
check_model_columns_have_meta_keys |
Columns defined for models must have the specified keys in the |
check_model_columns_have_types |
Columns defined for models must have a |
check_model_has_constraints |
Table and incremental models must have the specified constraint types defined. |
check_model_columns_have_relationship_tests
#
Columns matching a regex pattern must have a relationships test, optionally validating the target column and model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
column_name_pattern
|
str
|
Regex pattern to match column names that require a relationships test. |
required |
target_column_pattern
|
str | None
|
Regex pattern the target column ( |
None
|
target_model_pattern
|
str | None
|
Regex pattern the target model of the relationships test must match. If not provided, any target model is accepted. |
None
|
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
ModelNode
|
The ModelNode object to check. |
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. |
materialization |
Literal[ephemeral, incremental, table, view] | None
|
Limit check to models with the specified materialization. |
severity |
Literal[error, warn] | None
|
Severity level of the check. Default: |
Example(s):
manifest_checks:
- name: check_model_columns_have_relationship_tests
column_name_pattern: "_fk$"
target_column_pattern: "_pk$"
target_model_pattern: "^dim_|^fact_"
Source code in src/dbt_bouncer/checks/manifest/models/columns.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
check_model_columns_have_meta_keys
#
Columns defined for models must have the specified keys in the meta config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
keys
|
NestedDict
|
A list (that may contain sub-lists) of required keys. |
required |
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
ModelNode
|
The ModelNode object to check. |
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. |
materialization |
Literal[ephemeral, incremental, table, view] | None
|
Limit check to models with the specified materialization. |
severity |
Literal[error, warn] | None
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/models/columns.py
check_model_columns_have_types
#
Columns defined for models must have a data_type declared.
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
ModelNode
|
The ModelNode object to check. |
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. |
materialization |
Literal[ephemeral, incremental, table, view] | None
|
Limit check to models with the specified materialization. |
severity |
Literal[error, warn] | None
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/models/columns.py
check_model_has_constraints
#
Table and incremental models must have the specified constraint types defined.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
required_constraint_types
|
list[Literal[check, custom, foreign_key, not_null, primary_key, unique]]
|
List of constraint types that must be present on the model. |
required |
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
ModelNode
|
The ModelNode object to check. |
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):
manifest_checks:
- name: check_model_has_constraints
required_constraint_types:
- primary_key
include: ^models/marts