Access#
Note
The below checks require manifest.json to be present.
Checks related to model access controls and contract enforcement.
Functions:
| Name | Description |
|---|---|
check_model_access |
Models must have the specified access attribute. Requires dbt 1.7+. |
check_model_contract_enforced_for_public_model |
Public models must have contracts enforced. |
check_model_grant_privilege |
Model can have grant privileges that match the specified pattern. |
check_model_grant_privilege_required |
Model must have the specified grant privilege. |
check_model_has_contracts_enforced |
Model must have contracts enforced. |
check_model_number_of_grants |
Model can have the specified number of privileges. |
check_model_access
#
Models must have the specified access attribute. Requires dbt 1.7+.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
access
|
Literal[private, protected, public]
|
The access level to check for. |
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:
# Align with dbt best practices that marts should be `public`, everything else should be `protected`
- name: check_model_access
access: protected
include: ^models/intermediate
- name: check_model_access
access: public
include: ^models/marts
- name: check_model_access
access: protected
include: ^models/staging
Source code in src/dbt_bouncer/checks/manifest/models/access.py
check_model_contract_enforced_for_public_model
#
Public models must have contracts enforced.
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/access.py
check_model_grant_privilege
#
Model can have grant privileges that match the specified pattern.
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
ModelNode
|
The ModelNode object to check. |
privilege_pattern |
str
|
Regex pattern to match the privilege. |
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_grant_privilege
include: ^models/marts
privilege_pattern: ^select
Source code in src/dbt_bouncer/checks/manifest/models/access.py
check_model_grant_privilege_required
#
Model must have the specified grant privilege.
Receives at execution time:
| Name | Type | Description |
|---|---|---|
model |
ModelNode
|
The ModelNode object to check. |
privilege |
str
|
The privilege that is 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):
manifest_checks:
- name: check_model_grant_privilege_required
include: ^models/marts
privilege: select
Source code in src/dbt_bouncer/checks/manifest/models/access.py
check_model_has_contracts_enforced
#
Model must have contracts enforced.
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/access.py
check_model_number_of_grants
#
Model can have the specified number of privileges.
Receives at execution time:
| Name | Type | Description |
|---|---|---|
max_number_of_privileges |
int | None
|
Maximum number of privileges, inclusive. |
min_number_of_privileges |
int | None
|
Minimum number of privileges, inclusive. |
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_number_of_grants
include: ^models/marts
max_number_of_privileges: 1 # Optional
min_number_of_privileges: 0 # Optional