-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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] Incremental compilation error not handling column with quotes #4422
Comments
@ChristopheDuong Thanks for opening the thoughtful issues, here and in dbt-labs/dbt-adapters#160, with clear reproduction cases! Sorry for the long delay on our end—we've been re-organizing our collective triage, and a few got lost in the shuffle. This is definitely an edge case, and that's all the more reason to handle it. The tighter that dbt can be at handling these types of edge cases, the better for other tools (such as Airbyte) who wish to reliably perform the same operations across databases. This edge case crops up if a database's quoting characters (most often (On some databases, including a special character in the identifier name just isn't allowed to begin with: BigQuery, Spark. On others, such as Snowflake, we highly highly discourage it.) To be more precise, this is cropping up in the dbt-core/core/dbt/include/global_project/macros/materializations/models/incremental/merge.sql Line 57 in ed5df34
Lines 7 to 17 in ed5df34
I think we have two options here:
dbt-core/core/dbt/adapters/base/column.py Lines 35 to 37 in ed5df34
Reasons to prefer option 2:
Main downside: This would require extension to any databases that have implemented their own (If the distinction between In any case, the test case for this is definitely something we'd want to have in the "adapter zone" of test cases, for extension and validation on other adapters. Is this something you might be interested in helping us sort out? |
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue, or it will be closed in 7 days. |
Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest; add a comment to notify the maintainers. |
I'm seeing this issue on Redshift as well. Has any of the pre-work been done for this yet? |
Re-labeling to "closed as stale". |
Is there an existing issue for this?
Current Behavior
I've created a repository with multiple tests that summarizes compilation errors with SQL queries generated by dbt when running incremental models at: https://github.com/airbytehq/testing_dbt
One of the issues occurs when the models contain columns which identifiers include quoting characters and need to be referred to with quoting characters in the SQL queries:
The model file is:
see https://github.com/airbytehq/testing_dbt/blob/2d8f87b721e13122dd5fd9fa8088ee7734f9017e/first_project/models/column_with_quotes.sql
see https://github.com/airbytehq/testing_dbt/blob/2d8f87b721e13122dd5fd9fa8088ee7734f9017e/output/postgres-1-full-refresh-SUCCESS-dbt.log#L454
insert into
queries fails when using incremental materializationsee https://github.com/airbytehq/testing_dbt/blob/2d8f87b721e13122dd5fd9fa8088ee7734f9017e/output/postgres-2-incremental-FAILED-dbt.log#L2082
Expected Behavior
The expected SQL query should be:
Steps To Reproduce
Relevant log output
No response
Environment
What database are you using dbt with?
postgres, redshift, snowflake, other (mention it in "Additional Context")
Additional Context
The error occurs with:
The text was updated successfully, but these errors were encountered: