Directories#
Note
The below checks require manifest.json to be present.
Checks related to model file locations, names, and directory structure.
Functions:
| Name | Description |
|---|---|
check_model_directories |
Only specified sub-directories are permitted. |
check_model_file_name |
Models must have a file name that matches the supplied regex. |
check_model_property_file_location |
Model properties files must follow the guidance provided by dbt here. |
check_model_schema_name |
Models must have a schema name that matches the supplied regex. |
check_model_directories
#
Only specified sub-directories are permitted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include
|
str
|
Regex pattern to the directory to check. |
required |
permitted_sub_directories
|
list[str]
|
List of permitted sub-directories. |
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_directories
include: models
permitted_sub_directories:
- intermediate
- marts
- staging
# Restrict sub-directories within `./models/staging`
- name: check_model_directories
include: ^models/staging
permitted_sub_directories:
- crm
- payments
Source code in src/dbt_bouncer/checks/manifest/models/directories.py
check_model_file_name
#
Models must have a file name that matches the supplied regex.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_name_pattern
|
str
|
Regexp the file name must match. Please account for the |
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_file_name
description: Marts must include the model version in their file name.
include: ^models/marts
file_name_pattern: .*(v[0-9])\.sql$
Source code in src/dbt_bouncer/checks/manifest/models/directories.py
check_model_property_file_location
#
Model properties files must follow the guidance provided by dbt here.
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/directories.py
check_model_schema_name
#
Models must have a schema name that matches the supplied regex.
Note that most setups will use schema names in development that are prefixed, for example: * dbt_jdoe_stg_payments * mary_stg_payments
Please account for this if you wish to run dbt-bouncer against locally generated manifests.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schema_name_pattern
|
str
|
Regexp the schema name must match. |
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_schema_name
include: ^models/intermediate
schema_name_pattern: .*intermediate # Accounting for schemas like `dbt_jdoe_intermediate`.
- name: check_model_schema_name
include: ^models/staging
schema_name_pattern: .*stg_.*