Summary
You may encounter "Unable to locate SQLGetPrivateProfileString" or "Invalid connection string" errors when using pyodbc 4.0.34 with the Dremio ODBC driver (dremio-odbc-1.5.4.1002-1.x86_64). Downgrading to an earlier version of pyodbc, such as 4.0.32 or 4.0.33, resolves the issue and allows for a successful connection.
Reported Issue
The issue arises when upgrading to pyodbc 4.0.34, causing either of the following errors:
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)')
or
pyodbc.Error: ('HY000', '[HY000] [unixODBC][Dremio][Support] (50404) Invalid connection string. (50404) (SQLDriverConnect)')
Relevant Versions
pyodbc 4.0.34 and Dremio ODBC dremio-odbc-1.5.4.1002-1.x86_64
Troubleshooting Steps
Run the command "pip show pyodbc" to check your pyodbc version.
Cause
The issue appears to be related to a compatibility issue between pyodbc 4.0.34 and the Dremio ODBC driver version used.
Steps to Resolve
Downgrade to an earlier version of pyodbc, such as 4.0.32 or 4.0.33, to regain a successful connection.
Tips & Tricks
Best Practices
Recommendations
FAQ
Additional Resources
Please follow the issues/links below where similar behaviors are reported:
https://github.com/mkleehammer/pyodbc/issues/1079