diff --git a/.changes/1.5.0/Under the Hood-20230223-110314.yaml b/.changes/1.5.0/Under the Hood-20230223-110314.yaml deleted file mode 100644 index ef1e35744..000000000 --- a/.changes/1.5.0/Under the Hood-20230223-110314.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Under the Hood -body: Rename constraints_enabled to contract -time: 2023-02-23T11:03:14.344028-05:00 -custom: - Author: gshank - Issue: "330" diff --git a/.changes/unreleased/Under the Hood-20230223-110314.yaml b/.changes/unreleased/Under the Hood-20230223-110314.yaml new file mode 100644 index 000000000..a4f519569 --- /dev/null +++ b/.changes/unreleased/Under the Hood-20230223-110314.yaml @@ -0,0 +1,6 @@ +kind: Under the Hood +body: Treat contract config as a python object +time: 2023-02-23T11:03:14.344028-05:00 +custom: + Author: gshank emmyoop + Issue: 330 382 diff --git a/dbt/include/redshift/macros/adapters.sql b/dbt/include/redshift/macros/adapters.sql index ebf2e16a5..c863ee362 100644 --- a/dbt/include/redshift/macros/adapters.sql +++ b/dbt/include/redshift/macros/adapters.sql @@ -43,7 +43,8 @@ {{ sql_header if sql_header is not none }} - {%- if config.get('contract', False) %} + {%- set contract_config = config.get('contract') -%} + {%- if contract_config.enforced -%} create {% if temporary -%}temporary{%- endif %} table {{ relation.include(database=(not temporary), schema=(not temporary)) }} @@ -85,7 +86,8 @@ {{ sql_header if sql_header is not none }} create view {{ relation }} - {% if config.get('contract', False) -%} + {%- set contract_config = config.get('contract') -%} + {%- if contract_config.enforced -%} {{ get_assert_columns_equivalent(sql) }} {%- endif %} as ( {{ sql }}