You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
When I add some tests to my yml file in a field with special characters, I receive a sintax error.
Ex:
- name: uuid-part1data_tests:
- unique
- not_null
Response: column uuid does not exists in base_autoportal_reference_data
Expected Behavior
Tests executed perfectly.
Steps To Reproduce
You need to have your model with some fields with special characters in the column names.
Create your tests in your yml file in some of the column with the special characters.
Run the tests.
Relevant log output
No response
Environment
- OS: Mac
- Python:3.9.18
- dbt-core:1.8.1
- dbt-redshift:1.8.1
Additional Context
It's because the column names are not quoted in the tests.
At the moment, I have overwritten the macro tests with something like this:
{%macroredshift__test_unique(model, column_name) %}
select
"{{ column_name }}" as unique_field,
count(*) as n_records
from {{ model }}
where "{{ column_name }}" is not null
group by "{{ column_name }}"
having count(*) > 1
{%endmacro%}
The text was updated successfully, but these errors were encountered:
selectcount(*) as failures,
count(*) !=0as should_warn,
count(*) !=0as should_error
from (
select
UUID-field1as unique_field,
count(*) as n_records
from"xxxxx"."xxxxx"."xxxxxxxx"where UUID-field1 is not nullgroup by UUID-field1
havingcount(*) >1
) dbt_internal_test
And the issue: column "uuid" does not exist in xxxxx.
So quoting them it's the same as not quoting them.
Is this a new bug?
Current Behavior
When I add some tests to my yml file in a field with special characters, I receive a sintax error.
Ex:
Response:
column uuid does not exists in base_autoportal_reference_data
Expected Behavior
Tests executed perfectly.
Steps To Reproduce
Relevant log output
No response
Environment
Additional Context
It's because the column names are not quoted in the tests.
At the moment, I have overwritten the macro tests with something like this:
The text was updated successfully, but these errors were encountered: