Skip to content

Commit

Permalink
Upgrading schema test unique_comination_of_columns.sql to allow quoti…
Browse files Browse the repository at this point in the history
…ng of columns.
  • Loading branch information
JoshuaHuntley committed Aug 28, 2020
1 parent 7adb903 commit 12762a3
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions macros/schema_tests/unique_combination_of_columns.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
{% macro test_unique_combination_of_columns(model) %}
{% macro test_unique_combination_of_columns(model, quote_columns = false) %}

{%- set columns = kwargs.get('combination_of_columns', kwargs.get('arg')) %}

{%- set columns_csv=columns | join(', ') %}
{% if not quote_columns %}
{%- set column_list=columns %}
{% elif quote_columns %}
{%- set column_list=[] %}
{% for column in columns -%}
{% set column_list = column_list.append( adapter.quote(column) ) %}
{%- endfor %}
{% else %}
{{ exceptions.raise_compiler_error(
"`quote_columns` argument for unique_combination_of_columns test must be one of [True, False] Got: '" ~ quote ~"'.'"
) }}
{% endif %}

{%- set columns_csv=column_list | join(', ') %}


with validation_errors as (

Expand Down

0 comments on commit 12762a3

Please sign in to comment.