Hello Community,
I am getting this error below as shown on my mac and I have unixodbc installed and cp my odbc.ini and odbcinst.ini to my /etc directory and still keep getting this error not sure what I am missing.
see my script and configuration below.
Error
File "/Users/s.eromonsei/my_sandbox/Engineering/Dremio/odbc_dremio.py", line 17, in <module>
df =pd.read_sql(sql="""SELECT * FROM "Demo NYC Taxi"."Demo Taxi Reflection" limit 10;""", con=get_engine())
File "/Users/s.eromonsei/my_sandbox/Engineering/Dremio/odbc_dremio.py", line 15, in get_engine
engine = pyodbc.connect("DSN={}".format(driver), autocommit=True)
pyodbc.InterfaceError: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found and no default driver specified (0) (SQLDriverConnect)')
This is my python scripts
import os
import pandas as pd
from sqlalchemy import create_engine
import pyodbc
# change all the parameters
def get_engine():
driver = 'Arrow_Flight_SQL_ODBC_DSN'
engine = pyodbc.connect("DSN={}".format(driver), autocommit=True)
return engine
df =pd.read_sql(sql="""SELECT * FROM "Demo NYC Taxi"."Demo Taxi Reflection" limit 10;""", con=get_engine())
print(df)
This is my odbc.ini file
Arrow_Flight_SQL_ODBC_DSN]
Driver = /Library/Dremio/ODBC/lib/libarrow-flight-sql-odbc.dylib
Description = ODBC Driver DSN for Arrow Flight SQL developed by Dremio
Host = IP address
Port = 32010
UID = myemail@domain.com
PWD = PAT
useEncryption = 1
TrustedCerts = /Library/Dremio/ODBC/lib/cacerts.pem
UseSystemTrustedStore = 1
disableCertificateVerification = 0
This is my odbcinst.ini
[Arrow Flight SQL ODBC Driver]
Description = ODBC Driver for Arrow Flight SQL developed by Dremio
Driver = /Library/Dremio/ODBC/lib/libarrow-flight-sql-odbc.dylib
FileUsage = 1
UsageCount = 1
I also tried this approach and I was getting None
def conn_util():
try:
host = 'dremio-client.prod.ep.shell.com'
port = '32010'
uid = os.getenv("shell_uid")
pat = os.getenv("pat")
#driver = '/Library/Dremio/ODBC/lib/libdrillodbc_sbu.dylib'
# OR
driver = '/Library/Dremio/ODBC/lib/libarrow-flight-sql-odbc.dylib'
cert='/Library/Dremio/ODBC/lib/cacerts.pem'
# OR
#driver = "{Dremio Connector}" This is providing map in the odbcinst.ini
cnxn = pyodbc.connect("Driver={};ConnectionType=Direct;HOST={};PORT={};UID={};PWD={};trustedCerts={};useEncryption=true;useSystemTrustStore=false;disableCertificateVerification=false".format(
driver, host, port, uid, pat,cert), autocommit=True)
return cnxn
except:
print("Check your connection")
print(conn_util())