-
Notifications
You must be signed in to change notification settings - Fork 35
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Use variables to support option to enable and disable constraints applying to models; this follows the existing pattern applied to sources. Happy to start the PR if this is the approach to take and will be a benefit to the package.
# Global variables
vars:
# The package can be temporarily disabled using this variable
dbt_constraints_enabled: true
# You can be specific on which constraints are enabled for models
dbt_constraints_pk_enabled: true
dbt_constraints_uk_enabled: true
dbt_constraints_fk_enabled: true
dbt_constraints_nn_enabled: true
# The package can also add constraints on sources if you have sufficient privileges
dbt_constraints_sources_enabled: false
# You can also be specific on which constraints are enabled for sources
# You must also enable dbt_constraints_sources_enabled above
dbt_constraints_sources_pk_enabled: true
dbt_constraints_sources_uk_enabled: true
dbt_constraints_sources_fk_enabled: true
dbt_constraints_sources_nn_enabled: true{%- macro create_constraints(
...
{%- if 'not_null' in constraint_types and var('dbt_constraints_nn_enabled', false) -%}
{%- do dbt_constraints.create_constraints_by_type(['not_null'], quote_columns, lookup_cache) -%}
{%- endif -%}
...Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request