-
Notifications
You must be signed in to change notification settings - Fork 130
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] include_source_columns=false not working #181
Comments
Hi, Also when I use the include_source_columns=true it creates a wrong CTE as the columns are not escaped anymore. Or, some are escaped and other are not... Output would be eg: -- Generated by dbtvault.
|
Yes understood. I was just making sure that the placeholder was removed from the title. Feel free to modify! |
Hello, after some investigation this is an issue for a number of reasons. In terms of a solution, the proposed solution of making it like 0.8.3 where all source columns are escaped won't work for the same reasons we removed it: Escaping by default causes problems in different platforms, and creates unintended errors (especially around casing in postgres) which are frustrating for the user at best and breaking at worst. A potential way to fix this would be to have a new " It would work as below:
Which would cause "BOOKING DATE" to be escaped in the source columns. We're currently working out how this would interact with the existing escaping solution and will keep this issue updated. @klaus1978 Please let us know what you think 😄 |
Hi, KR Klaus |
Hi, thanks for your response! The idea here is that dbtvault would automatically ensure that the columns in The best practise here would then be to create derived columns which 'fix' the problem columns (i.e. aliases "BOOKING DATE" as "BOOKING_DATE") and would mean you don't have to worry about this downstream. Saying this, this approach would still give users the option to either alias them or leave them as-is, depending on preference. Does that make sense? |
Well, If you have to rename the fields anyway, then I guess there is another possibility where you (the dbtvault team) would not have to do anything: just rename it in a dbt model before you pass it to the stage macros? KR Klaus |
Describe the bug
After upgrading to 0.9.2 (from 0.8.3) I realized problems in the Stage macro when there are weird field names (eg with special characters or blanks) as the escaping is not done automatically anymore.
Environment
dbt version: 1.3.2
dbtvault version: 0.9.2
Database/Platform: Snowflake
To Reproduce
if it is not me, but a general issue:
{{ dbtvault.stage(include_source_columns=false,
If you check the compiled file, you will see all fields from source in the CTE "source_data" are included ( I would have thought that would be prevented by include_source_columns=false)
and not all of them are escaped by '" "' which is causing the problem with unusual field names...
Expected behavior
Best would be the same behavior as in 0.8.3:
all fields in CTE source_data were escaped...
see also https://dbtvault.slack.com/archives/CRLDUSDEF/p1673540131308529
Many thanks in advance
Klaus
AB#5348
The text was updated successfully, but these errors were encountered: