Lineage#
Note
The below checks require manifest.json to be present.
Checks related to model upstream dependencies and lineage.
Functions:
| Name | Description |
|---|---|
check_model_depends_on_macros |
Models must depend on the specified macros. |
check_model_depends_on_multiple_sources |
Models cannot reference more than one source. |
check_model_has_exposure |
Models must have an exposure. |
check_model_has_no_upstream_dependencies |
Identify if models have no upstream dependencies as this likely indicates hard-coded tables references. |
check_model_max_chained_views |
Models cannot have more than the specified number of upstream dependents that are not tables. |
check_model_max_fanout |
Models cannot have more than the specified number of downstream models. |
check_model_max_upstream_dependencies |
Limit the number of upstream dependencies a model has. |
check_model_depends_on_macros
#
Models must depend on the specified macros.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
criteria
|
str
|
(Literal["any", "all", "one"] | None): Whether the model must depend on any, all, or exactly one of the specified macros. Default: |
'all'
|
required_macros
|
list[str]
|
(list[str]): List of macros the model must depend on. All macros must specify a namespace, e.g. |
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):
manifest_checks:
- name: check_model_depends_on_macros
required_macros:
- dbt.is_incremental
- name: check_model_depends_on_macros
criteria: one
required_macros:
- my_package.sampler
- my_package.sampling
Source code in src/dbt_bouncer/checks/manifest/models/lineage.py
check_model_depends_on_multiple_sources
#
Models cannot reference more than one source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
ModelNode
|
The ModelNode object to check. |
required |
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/lineage.py
check_model_has_exposure
#
Models must have an exposure.
Receives at execution time:
| Name | Type | Description |
|---|---|---|
exposures |
list[ExposureNode]
|
List of ExposureNode objects parsed from |
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_has_exposure
description: Ensure all marts are part of an exposure.
include: ^models/marts
Source code in src/dbt_bouncer/checks/manifest/models/lineage.py
check_model_has_no_upstream_dependencies
#
Identify if models have no upstream dependencies as this likely indicates hard-coded tables references.
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/lineage.py
check_model_max_chained_views
#
Models cannot have more than the specified number of upstream dependents that are not tables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
materializations_to_include
|
list[str] | None
|
List of materializations to include in the check. |
['ephemeral', 'view']
|
max_chained_views
|
int | None
|
The maximum number of upstream dependents that are not tables. |
3
|
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
ModelNode
|
The ModelNode object to check. |
models |
list[ModelNode]
|
List of ModelNode 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. |
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_max_chained_views
materializations_to_include:
- ephemeral
- my_custom_materialization
- view
max_chained_views: 5
Source code in src/dbt_bouncer/checks/manifest/models/lineage.py
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 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | |
check_model_max_fanout
#
Models cannot have more than the specified number of downstream models.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_downstream_models
|
int | None
|
The maximum number of permitted downstream models. |
3
|
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
ModelNode
|
The ModelNode object to check. |
models |
list[ModelNode]
|
List of ModelNode 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. |
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/lineage.py
check_model_max_upstream_dependencies
#
Limit the number of upstream dependencies a model has.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_upstream_macros
|
int | None
|
The maximum number of permitted upstream macros. |
5
|
max_upstream_models
|
int | None
|
The maximum number of permitted upstream models. |
5
|
max_upstream_sources
|
int | None
|
The maximum number of permitted upstream sources. |
1
|
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):