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] Unittests Fail with Quoted Source Table Columns in dbt Framework #11015

Closed
2 tasks done
megetron3 opened this issue Nov 20, 2024 · 1 comment
Closed
2 tasks done
Labels
bug Something isn't working case_sensitivity Issues related to dbt's case-sensitivity behavior 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

@megetron3
Copy link

megetron3 commented Nov 20, 2024

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

We have encountered an issue with the dbt unittests framework where our source table columns are quoted. During unit testing, these cases fail due to the unquoted column name being labeled as an "invalid identifier."

Expected Behavior

Unittests should pass successfully.
The framework should correctly identify and use quoted column names as specified in the source tables.
There should be no "invalid identifier" errors due to quoting issues.

Steps To Reproduce

Source Table:

CREATE TABLE "source_table" (
    "column1" INTEGER,
    "column2" VARCHAR(255)
);

Model:

SELECT
    "column1",
    "column2"
FROM
    {{ ref('source_table') }}

Test:

unit_tests:
  - name: test_quoted_columns
    description: "Ensure columns of a given input will be quoted."
    model: source_table
    given:
      - input: ref('source_table')
        rows:
          - {"column1": 1, "column2": 'value1'}
          - {"column1": 2, "column2": 'value2'}
    expect:
      rows:
        - {"column1": 1, "column2": 'value1'}
        - {"column1": 2, "column2": 'value2'}

Relevant log output

No response

Environment

- OS: iOS
- Python:
- dbt: 1.8.7

Which database adapter are you using with dbt?

No response

Additional Context

No response

@megetron3 megetron3 added bug Something isn't working triage labels Nov 20, 2024
@dbeatty10 dbeatty10 added quoting Issues related to dbt's quoting behavior case_sensitivity Issues related to dbt's case-sensitivity behavior unit tests Issues related to built-in dbt unit testing functionality labels Nov 21, 2024
@dbeatty10
Copy link
Contributor

Thanks for opening this @megetron3 !

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

@dbeatty10 dbeatty10 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 22, 2024
@dbeatty10 dbeatty10 added duplicate This issue or pull request already exists and removed triage labels Nov 22, 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 case_sensitivity Issues related to dbt's case-sensitivity behavior 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