Overview
You may find that your pyodbc script is now failing with either Unable to locate SQLGetPrivateProfileString
or Invalid connection string
errors.
In which case, first run command "pip show pyodbc" to check your pyodbc version.
Applies To
pyodbc 4.0.34 and Dremio ODBC dremio-odbc-1.5.4.1002-1.x86_64
Details
The issue will start to appear as soon as you upgrade to pyodbc 4.0.34 with error below:
Traceback (most recent call last):
File "/runner.py", line 79, in <module>
(conn, node_check_table) = build_connection(ENGINE)
File "/runner.py", line 54, in build_connection
conn = pyodbc.connect(f"driver={DRIVER_PATH};server={DREMIO_HOST};uid={DREMIO_USER};pwd={DREMIO_PASS};port={DREMIO_PORT};schema={CONTEXT}", autocommit=True)
pyodbc.Error: ('HY000', '[HY000] [unixODBC][Dremio][ODBC] (11560) Unable to locate SQLGetPrivateProfileString function: [Dremio][DSI] An error occurred while attempting to retrieve the error message for key \'LibsLoadErr\' with message parameters [\'""\'] and component ID 3: Message not found in file "/opt/dremio-odbc/share/ErrorMessages/en-US/ODBCMessages.xml" (11560) (SQLDriverConnect)')
You may also hit a different error:
pyodbc.Error: ('HY000', '[HY000] [unixODBC][Dremio][Support] (50404) Invalid connection string. (50404) (SQLDriverConnect)')
A downgrade to any earlier version (4.0.32 or 4.0.33 in our tests) helps regain a successful connection.
Further Reading
Please follow the issue/links below where similar behaviours are reported
https://github.com/mkleehammer/pyodbc/issues/1079
https://github.com/mkleehammer/pyodbc/issues/1082
https://github.com/mkleehammer/pyodbc/issues/1083