-
Notifications
You must be signed in to change notification settings - Fork 3
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
Snowflake column name case-sensitive #148
Comments
Hi @0xbe7a - thanks for your careful write-up.
|
Yes, you are correct, this issue stems from the fact that "ALTER" is quoted. The quotation is required because ALTER is a SQL keyword, but "JAHR" will result in the same behaviour. This quotation is problematic here because datajudge converts all column names to lowercase. This breaks here since Double-quoted Identifiers are case-sensitive on Snowflake (https://docs.snowflake.com/en/sql-reference/identifiers-syntax). This results in the KeyError since the casing is messed up |
I see. For context, we came up with this work-around because the out-of-the box behaviour of Since we are not the only people who are unhappy with the current default behaviour, others seemed to have written their internal work-arounds, too. In particular Unfortunately I haven't had the chance to look into the latter in greater detail. If this is something that you find relevant interesting, it'd certainly be useful if you could have a look at it in order to assess whether we could follow a similar approach with datajudge. No pressure, though. |
I am trying to specify constraints for a Snowflake table with a schema that includes a column named "ALTER". After adding an
add_uniques_equality_constraint
constraint, testing the code results in aKeyError: 'alter'
error.Steps to Reproduce
add_uniques_equality_constraint
constraint:Expected Behavior
The code should run without errors.
Actual Behavior
Running the code results in a KeyError: 'alter' error.
Root Cause
The issue is caused by the Snowflake capitalization fix (https://github.com/Quantco/datajudge/blob/main/src/datajudge/db_access.py#L346). This fix forces the column name to be lowercase, which interferes with the case-sensitive "ALTER" column name in the table schema.
The text was updated successfully, but these errors were encountered: