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

[Bug] Unit Test Failed When using quoted column in snowflake #10146

Closed
2 tasks done
chura-awashima opened this issue May 14, 2024 · 1 comment
Closed
2 tasks done

[Bug] Unit Test Failed When using quoted column in snowflake #10146

chura-awashima opened this issue May 14, 2024 · 1 comment
Labels
bug Something isn't working duplicate This issue or pull request already exists quoting Issues related to dbt's quoting behavior unit tests Issues related to built-in dbt unit testing functionality

Comments

@chura-awashima
Copy link

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

In Snowflake

this is target model file sample.sql

SELECT 1 as "a", 'c' as "b" FROM {{ ref('stg') }}

and this is parent model file stg.sql

SELECT 'a' as id

the first unit test file

unit_tests:
  - name: sample_test
    description: "sample failed test"
    model: sample
    given:
      - input: ref('stg')
        rows:
            - {id: "a"}
    expect:
      rows:
        - {a: 1, b: 'c'}

I got an error

An error occurred during execution of unit test 'sample'. There may be an error in the unit test definition: check the data types.
   Database Error
    000904 (42000): SQL compilation error: error line 3 at position 4
    invalid identifier 'A'

OK, I want to use quoted column so change unittest to

unit_tests:
  - name: sample
    description: "sample failed test"
    model: sample
    given:
      - input: ref('stg')
        rows:
            - {id: "a"}
    expect:
      rows:
        - {"a": 1, "b": 'c'}

but got same error.

Expected Behavior

I want use expect column such like "a"

Steps To Reproduce

  1. create stg model
  2. create sample model
  3. dbt run
  4. dbt test

Relevant log output

No response

Environment

- OS: Mac 14.1.1
- Python: 3.11.4
- dbt: 1.8.0 snowflake 1.8.0

Which database adapter are you using with dbt?

snowflake

Additional Context

No response

@chura-awashima chura-awashima added bug Something isn't working triage labels May 14, 2024
@dbeatty10 dbeatty10 added quoting Issues related to dbt's quoting behavior unit tests Issues related to built-in dbt unit testing functionality labels May 14, 2024
@dbeatty10
Copy link
Contributor

Thanks for reporting this @chura-awashima !

This looks the same as dbt-labs/dbt-adapters#205 to me, so I'm going to close this one as a duplicate.

@dbeatty10 dbeatty10 closed this as not planned Won't fix, can't repro, duplicate, stale May 14, 2024
@dbeatty10 dbeatty10 added duplicate This issue or pull request already exists and removed triage labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists quoting Issues related to dbt's quoting behavior unit tests Issues related to built-in dbt unit testing functionality
Projects
None yet
Development

No branches or pull requests

2 participants