[BUG] expect_select_column_values_to_be_unique_within_record Doesn't Allow for Different Data Types
bkimjin opened this issue · comments
Brian commented
Is this a new bug in dbt-expectations?
- I believe this is a new bug in dbt-expectations
- I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
When attempting to use this test for a string and a date column, it errors out on unpivot_columns
because they are different data types.
Expected Behavior
The test should complete.
Steps To Reproduce
Add the following lines to a model in the yml file:
tests:
- dbt_expectations.expect_select_column_values_to_be_unique_within_record:
column_list: ["any_string_field", "any_date_field"]
Run dbt test
Relevant log output
Environment
- OS: MacOS
- Python: 3.10.12
- dbt: 1.6.9
- dbt-expectations: 0.10.1
Which database adapter are you using with dbt?
Note: dbt-expectations currently does not support database adapters other than the ones listed below.
- Postgres
- Snowflake ✅
- BigQuery
Additional Context
This could be solved by wrapping the {{column}} in MD5:
select row_index, '{{ column }}' as column_name, {{ column }} as column_value from column_values
to:
select row_index, '{{ column }}' as column_name, md5({{ column }}) as column_value from column_values