Connect Dremio with ipython notebook

I was trying to connect to ipython notebook with dremio server on my localhost (MacOS) by could not connect to it. Python version is 2.7 and pyodbc version is 3.1.1 My code below:
import pyodbc, pandas

host = 'localhost’
port = 31010
uid = '******'
pwd = ‘******’
#driver =

cnxn = pyodbc.connect(“Driver={Dremio-ODBC};ConnectionType=Direct;HOST={%s};PORT={%d};AuthenticationType=Plain;UID={%s};PWD={%s}”.format(driver, host,port,uid,pwd),autocommit=True)

sql = ‘’‘SELECT * FROM data’’’

dataframe = pandas.read_sql(sql,cnxn)

Any help on this?

Can you share the error message with us?

Make sure you also installed the ODBC Connector for MacOS, as it doesn’t come with the server application. You can find it at https://www.dremio.com/download/ and ODBC instructions are at: https://docs.dremio.com/drivers/

Note also that pyodbc and ODBC configuration on Mac might be slightly harder than on other platforms. MacOS provides an ODBC manager (iODBC), which can be configured by updating configuration files under /Library/ODBC (and ~/Library/ODBC).When you run the Dremio Connector installer program, it registers the driver with it automatically. But for some reason, pyodbc on MacOS often requires another ODBC manager: unixODBC, and unixODBC configuration files are often located under /etc. If you are in this situation, you will have to update unixODBC configuration file to register the Dremio ODBC connector (you can simply copy the iODBC configuration).

This is the error
Error: (‘01000’, u"[01000] [unixODBC][Driver Manager]Can’t open lib ‘Dremio ODBC’ : file not found (0) (SQLDriverConnect)")

It seems your pyodbc installation uses unixODBC. Can you see if the details I provided to you on how to configure unixODBC on Mac for the Dremio ODBC driver is helpful to you?

I had a similar issue. If you look at /Library/ODBC/odbc.ini, you should see the configuration for the Dremio connector. Under the driver property, copy the given path and try using that for the driver string in your code. Mine is /Library/Dremio/ODBC/lib/libdrillodbc_sbu.dylib. This is an old thread, but someone hopefully will find it useful :wink:

1 Like

Thank you @benji, you saved me a lot of time. Maybe this should be included somewhere in the documentation as almost two years later the issue persists.

@rmlopes, you can also copy the example odbc.ini file in your MacOS home directory and call it .odbc.ini. Then you could specify the DSN value in your connection string to be one those listed in that file.