Skip to content
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

Fix identifier case handling #39

Merged
merged 2 commits into from
Mar 21, 2024
Merged

Fix identifier case handling #39

merged 2 commits into from
Mar 21, 2024

Conversation

hab6
Copy link
Contributor

@hab6 hab6 commented Mar 21, 2024

Description

Removed forced conversion of identifiers to lowercase so that uppercase and mixed-case scenarios now work properly.

Also removed encoding/decoding of string to bytes. Proper handling (if needed) will be dealt with via #36.

Testing - Python Script

Ran the attached case_test.py which uses SQLAlchemy inspection to get column information for existing tables. Target DBMS tested: Vector 6.3 database on Ubuntu and Ingres 11.2 database on Windows

case_test.py.txt

Example output

Python 3.10.7 (tags/v3.10.7:6cc6b13, Sep  5 2022, 14:08:36) [MSC v.1933 64 bit (AMD64)] on win32

2.0.28
ingres://testuser:TESTPWD@TESTMACHINE:21064/casedb
(['Driver={Actian II};Database=casedb;HostName=TESTMACHINE;ListenAddress=21064;UID=testuser;PWD=TESTPWD'], {})
('II 11.2.0 (a64.win/100)',)
('testuser                        ', 'otheruser                       ', '$ingres                         ')
('DB_DELIMITED_CASE               ', 'MIXED                           ')
('DB_NAME_CASE                    ', 'LOWER                           ')
('DB_REAL_USER_CASE               ', 'LOWER                           ')
('MIXEDCASE_NAMES                 ', 'N                               ')

============================================================================
================  Table names as stored with actual case  ==================
============================================================================
('TABLE UPPER DELIMITED ',)
('Table Mixed Delimited ',)
('table lower delimited ',)
('table_lower ',)
('table_mixed ',)
('table_upper ',)

=====================================================================================
=====  Table Names Inspections using SQLAlchemy-Ingres method: get_table_names  =====
=====================================================================================
['TABLE UPPER DELIMITED', 'table_lower', 'table lower delimited', 'table_upper', 'Table Mixed Delimited', 'table_mixed']

=======================================================
===============  Columns of each table  ===============
=======================================================
Columns for table ( TABLE UPPER DELIMITED ): [{'name': 'COL1 DELIM', 'nullable': True, 'default': None, 'type': Integer()}]
Columns for table ( table_lower ): [{'name': 'col1', 'nullable': True, 'default': None, 'type': Integer()}]
Columns for table ( table lower delimited ): [{'name': 'col1 delim', 'nullable': True, 'default': None, 'type': Integer()}]
Columns for table ( table_upper ): [{'name': 'col1', 'nullable': True, 'default': None, 'type': Integer()}]
Columns for table ( Table Mixed Delimited ): [{'name': 'Col1 Delim', 'nullable': True, 'default': None, 'type': Integer()}]
Columns for table ( table_mixed ): [{'name': 'col1', 'nullable': True, 'default': None, 'type': Integer()}]

Testing - Apache Superset

Python 3.10.12

apache-superset           3.1.1
pyodbc                    5.1.0
pypyodbc                  1.3.6
SQLAlchemy                1.4.51.dev0
sqlalchemy-ingres         0.0.7.dev1

Tested Superset's auto-retrieval of column metadata and row data in Superset SQL Lab, plus adhoc SQL statements in SQL Lab. Used backends of Ingres 11.2 on Windows and Vector 6.3 on Ubuntu. All sanity tests ran successfully, correctly retrieving the data.

@clach04 clach04 merged commit de0ea48 into master Mar 21, 2024
@clach04 clach04 deleted the hab6-case-fix branch March 21, 2024 21:36
@vsreeniv
Copy link

vsreeniv commented Mar 22, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants