Skip to content

Snowflake column name case-sensitive #148

@0xbe7a

Description

@0xbe7a

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

  1. Create a Snowflake table with the following schema:
create or replace TABLE EXAMPLE (
	JAHR FLOAT,
	"ALTER" FLOAT
);
  1. Add a add_uniques_equality_constraint constraint:
requirement.add_uniques_equality_constraint(
    ["ALTER"], list(range(0, 100 + 1))
)
  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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions