[PLU-121]: fix Teradata connector case sensitivity for Enterprise databases#651
[PLU-121]: fix Teradata connector case sensitivity for Enterprise databases#651simoncoombes wants to merge 2 commits intomainfrom
Conversation
…abases Enterprise Teradata uppercases column names in cursor.description, causing KeyError when the downloader and uploader try to match them against user-provided lowercase config values. Normalize column names to lowercase in TeradataDownloader.query_db and TeradataUploader.get_table_columns.
|
@claude please review |
|
Claude finished @potter-potter's task —— View job Code Review Complete ✅Reviewing PR for Teradata connector case sensitivity fix. Todo List:
Review SummaryOverall Assessment: ✅ APPROVED This is a well-targeted fix for a real compatibility issue between Enterprise Teradata and ClearScape Analytics environments. The changes are minimal, focused, and address the root cause effectively. Detailed Review✅ Root Cause AnalysisThe PR correctly identifies the issue: Enterprise Teradata follows ANSI SQL spec by folding unquoted identifiers to uppercase, while ClearScape Analytics preserves case. This causes ✅ Solution ApproachNormalizing column names to lowercase in both the downloader and uploader is the right approach:
✅ Code Quality
✅ Backward Compatibility
✅ Error HandlingThe fix prevents the Minor Observations
RecommendationsNo changes required - this is a solid, minimal fix that directly addresses the issue without unnecessary complexity. |
Summary
cursor.description, while ClearScape Analytics preserves the original caseKeyErrorin the downloader when it tries to look up the user-configuredid_column(lowercase) against uppercase DataFrame columnsTeradataDownloader.query_db(line 157) andTeradataUploader.get_table_columns(line 205)Root Cause
Standard Enterprise Teradata folds unquoted identifiers to uppercase per the ANSI SQL spec. The existing connector was only tested against ClearScape Analytics (Teradata's developer edition), which preserves case as-typed. When a customer pointed the connector at Enterprise Teradata,
cursor.descriptionreturnedIDinstead ofid, causing the downstreamresult.iloc[0][id_column]lookup to fail withKeyError: 'id'.Changes
TeradataDownloader.query_db:columns = [col[0].lower() for col in cursor.description]TeradataUploader.get_table_columns:self._columns = [desc[0].lower() for desc in cursor.description]Test plan
teradata-case-fix) on SND with ClearScape source — no regression