Skip to content

Commit

Permalink
update to retrieve contract enforced from dict (dbt-labs#383)
Browse files Browse the repository at this point in the history
* update to retrieve contract enforced from dict

* add dependecy on branch

* change ref

* Update Under the Hood-20230223-110314.yaml

* remove extra get

* revert branch dependency
  • Loading branch information
emmyoop authored Mar 28, 2023
1 parent f1776ed commit 464ae0b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 0 additions & 6 deletions .changes/1.5.0/Under the Hood-20230223-110314.yaml

This file was deleted.

6 changes: 6 additions & 0 deletions .changes/unreleased/Under the Hood-20230223-110314.yaml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 4 additions & 2 deletions dbt/include/redshift/macros/adapters.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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)) }}
Expand Down Expand Up @@ -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 }}
Expand Down

0 comments on commit 464ae0b

Please sign in to comment.