Skip to content

Commit

Permalink
bigquery compat (they don't like except)
Browse files Browse the repository at this point in the history
  • Loading branch information
joellabes committed Dec 2, 2021
1 parent ef240c7 commit 614a8fc
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
{% set column_values = dbt_utils.get_column_values(ref('data_get_column_values_dropped'), 'field', default=['y', 'z'], order_by="field") %}

with expected as (
select {{ dbt_utils.safe_cast("'y'", dbt_utils.type_string()) }} as expected union all
select {{ dbt_utils.safe_cast("'z'", dbt_utils.type_string()) }} as expected
select {{ dbt_utils.safe_cast("'y'", dbt_utils.type_string()) }} as expected_column_value union all
select {{ dbt_utils.safe_cast("'z'", dbt_utils.type_string()) }} as expected_column_value
),

actual as (

{% for val in column_values %}
select {{ dbt_utils.safe_cast("'" ~ val ~ "'", dbt_utils.type_string()) }} as actual
select {{ dbt_utils.safe_cast("'" ~ val ~ "'", dbt_utils.type_string()) }} as actual_column_value
{% if not loop.last %}
union all
{% endif %}
Expand All @@ -18,8 +18,9 @@ actual as (

failures as (
select * from actual
except
select * from expected
where actual.actual_column_value not in (
select expected.expected_column_value from expected
)
)

select * from failures

0 comments on commit 614a8fc

Please sign in to comment.