Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix value in set validation #91

Merged
merged 5 commits into from
Jul 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions integration_tests/models/schema_tests/data_test.sql
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
select
1 as idx,
'2020-10-21' as date_col,
cast(0 as{{ dbt_utils.type_float() }}) as col_numeric_a,
cast(1 as{{ dbt_utils.type_float() }}) as col_numeric_b,
cast(0 as {{ dbt_utils.type_float() }}) as col_numeric_a,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, not sure how that happened!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interestingly, the old version compiles to

cast(0 as
    float64
) as col_numeric_a

so shouldn't throw an error but still a good change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for me it was compiling as cast(0 asfloat64) as col_numneric_a so it was throwing an error

cast(1 as {{ dbt_utils.type_float() }}) as col_numeric_b,
'a' as col_string_a,
'b' as col_string_b,
cast(null as{{ dbt_utils.type_string() }}) as col_null
cast(null as {{ dbt_utils.type_string() }}) as col_null

union all

Expand Down
3 changes: 3 additions & 0 deletions integration_tests/models/schema_tests/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ models:

- name: col_string_a
tests:
- dbt_expectations.expect_column_values_to_be_in_set:
value_set: ['a', 'b', 'c']
quote_values: true
- dbt_expectations.expect_column_values_to_not_be_in_set:
value_set: ['2','3']
quote_values: true
Expand Down
1 change: 1 addition & 0 deletions macros/math/rand.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@
random()

{%- endmacro -%}

Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ validation_errors as (
left join
set_values s on v.value_field = s.value_field
where
v.value_field is null
s.value_field is null

)

Expand Down