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 a KeyError: 'alter' error.
Steps to Reproduce
- Create a Snowflake table with the following schema:
create or replace TABLE EXAMPLE (
JAHR FLOAT,
"ALTER" FLOAT
);
- Add a
add_uniques_equality_constraint constraint:
requirement.add_uniques_equality_constraint(
["ALTER"], list(range(0, 100 + 1))
)
- Test the constraints
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.
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_constraintconstraint, testing the code results in aKeyError: 'alter'error.Steps to Reproduce
add_uniques_equality_constraintconstraint: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.