Directories#
Note
The below checks require manifest.json to be present.
Checks related to source directory and file locations.
Functions:
| Name | Description |
|---|---|
check_source_property_file_location |
Source properties files must follow the guidance provided by dbt here. |
check_source_file_name |
Sources must have a file name that matches the supplied regex. |
check_source_property_file_location
#
Source properties files must follow the guidance provided by dbt here.
Rationale
dbt's official project structure guide recommends placing source properties files in the staging layer alongside the models that consume them, with a predictable naming convention (e.g. _<layer>__sources.yml). Following this convention makes it immediately obvious where to find a source's configuration, prevents properties files from being scattered across arbitrary directories, and ensures that new team members can navigate the project without guesswork. This check codifies the convention so it is enforced automatically rather than relied upon by convention alone.
Receives at execution time:
| Name | Type | Description |
|---|---|---|
source |
SourceNode
|
The SourceNode 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 source path (i.e the .yml file where the source is configured). Source paths that match the pattern will not be checked. |
include |
str | None
|
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. |
severity |
Literal[error, warn] | None
|
Severity level of the check. Default: |
Example(s):
Source code in src/dbt_bouncer/checks/manifest/sources/directories.py
check_source_file_name
#
Sources must have a file name that matches the supplied regex.
Rationale
Consistent file naming conventions (e.g. _stripe__sources.yml) make it easy to identify a source's purpose at a glance. Enforcing naming patterns in CI prevents deviations that accumulate over time and make the project harder to navigate.
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 |
|---|---|---|
source |
SourceNode
|
The SourceNode 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 source path (i.e the .yml file where the source is configured). Source paths that match the pattern will not be checked. |
include |
str | None
|
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. |
severity |
Literal[error, warn] | None
|
Severity level of the check. Default: |
Example(s):
manifest_checks:
- name: check_source_file_name
description: Sources must have a file name that starts with an underscore and ends with `__sources.yml`.
file_name_pattern: ^_.*__sources\.yml$