Task:
Setup connection to Azure SQL Server.
A couple things have changed...
*We've started using Unity Catalog, so need Unity Catalog -enabled clusters
*Legacy init scripts have been deprecated, and this is how we had our pyodbc setup, etc. defined.
Code:
import pyodbc
def build_odbc_connection(dbserver, dbname, username, pwd):
conn = pyodbc.connect('DRIVER={ODBC Driver 18 for SQL Server};SERVER='+dbserver+';DATABASE='+dbname+';ENCRYPT=yes;UID='+username+';PWD='+ pwd)
return conn
def execute_azsql_query(sqlquery):
conn = build_odbc_connection(sec_SourceServer, sec_SourceDatabase,sec_SinkAzSqlAppID,sec_SinkAzSqlSecret)
df = pd.read_sql(sqlquery,conn)
conn.close()
return df
execute_azsql_query('select * from dbo.client')
Error:
('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 18 for SQL Server' : file not found (0) (SQLDriverConnect)")
What am I missing here? Thanks!