[Resolved] Python odbc error while fetching the data from source | Big Data | Python

In this article, we will explain how to resolve the Python ODBC below error in the Big data Cloudera cluster platform and we have provided solution for this error.


Traceback (most recent call last):
File "/home/cdsw/app/sql_tools.py", line 61 in
File "/home/cdsw/app/sql_tools.py", line 54in get_closeout_customers
with self.conn_manager() as c:
File "/usr/local/lib/python3.9/contextlib.py", line 180 in enter
return next(self.gen)
File "/home/cdsw/app/sql_tools.py", line 27, in conn_manager
conn = pyodbc.connect(r'Driver=/opt/cloudera/impalaodbc/lib/64/libclouderaimpalaodbc64.so;' +
pyodbc.Error: ('HY000', '[HY000] [unixODBC][Cloudera][ODBC] Unable to locate SQLGetPrivateProfileString function: [Cloudera][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/cloudera/impalaodbc/ErrorMessages//en-US/ODBCMessages.xml" (SQLDriverConnect)')

Attach error message(s):


Here we provided simple resolution for Python ODBC issue.

In Cloudera Data Platform check the Hive database connections like ODBC (Oracle Database Connectivity) or JDBC (Java Database Connectivity) connection string.

First, login the Python prompt in CLI mode and run the above command. Check the CDSW (Cloudera Data Science Workbench) versions, services. Whether any service is went to down. Please confirm it once, if any issue in CDSW try  to up.

Second, check the CDSW and Python compatible versions.

Here Python 3.9 version  and try to change the version 3.6. After changed the version Python 3.6 and then run the script.


Select the proper version Docker image that must be suitable for Python build version and then install it on the Cloudera platform from the Admin team.

Here also version should be compatible otherwise will get the same error.

Basically, it’s complete depends upon the Big Data distribution it may be either Cloudera Data Hadoop or Cloudera Data Platform (It includes Hortonworks)

And more we can use any Cloud based platforms as well. For example Azure based and AWS (Amazon Web Service) based platforms from cluster side.

Summary: Most of the case it depend on the Versions issues in the services and Python.