Closed cboethigtrellance closed 1 month ago
Thanks for raising this issue @cboethigtrellance !
I think the root cause is that unit tests are not taking the quote
configuration into account.
Create these files:
models/my_model.sql
select 1 as "Branch Id"
models/_properties.yaml
models:
- name: my_model
columns:
- name: Branch Id
quote: true
tests:
- not_null
unit_tests:
- name: dbt_core_10748
model: my_model
given: []
expect:
rows:
- {"Branch Id": "1"}
Run these commands:
dbt test -s my_model
We already have an issue open for this, so I'm going to close this as a duplicate of https://github.com/dbt-labs/dbt-adapters/issues/205.
Is this a new bug in dbt-core?
Current Behavior
While running my dbt unit tests for one of my models, it fails to compile. I am running this test on a table that has quoted columns (Bad practice I know). As shown in the output, it does not enforce quoted column names in my models.yml file, therefore trying to select non quoted columns that have spaces and special characters.
I have searched the documentation for any properties relating to quotes but could not find any here: https://docs.getdbt.com/reference/resource-properties/unit-tests
Here is my unit test:
Here is the models.yml file:
Expected Behavior
The test should pass however it won't even compile correctly
Steps To Reproduce
Relevant log output
Environment
Which database adapter are you using with dbt?
snowflake
Additional Context
No response