Snowflake column name case-sensitive

Open
#148 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
databases

Research direction

Start in src/datajudge/db_access.py around line 346, where Snowflake column-name capitalization is normalized. Reproduce the KeyError with the quoted "ALTER" column and the add_uniques_equality_constraint call. Done means the constraint test runs without a KeyError while preserving the schema's case-sensitive column name.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Python
Stars
46
Forks
3
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Quantco/datajudge

All issues in Quantco/datajudge

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.