from sqlalchemy import create_engine
import pyodbc
AZUREUID = ‘######’ # Azure SQL database userid
AZUREPWD = ‘######’ # Azure SQL database password
AZURESRV = ‘#######’ # Azure SQL database server name (fully qualified)
AZUREDB = ‘####’ # Azure SQL database name (if it does not exit, pandas will create it)
DRIVER = ‘{ODBC Driver 17 for SQL Server}’
connectionstring = ‘mssql+pyodbc://{uid}:{password}@{server}:1433/{database}?driver={driver}’.format(
uid=AZUREUID,
password=AZUREPWD,
server=AZURESRV,
database=AZUREDB,
driver=DRIVER.replace(’ ', ‘+’))
engine = create_engine(connectionstring)
when i try to run the code above, it gives error DBAPIError: (pyodbc.Error) (‘01000’, “[01000] [unixODBC][Driver Manager]Can’t open lib ‘{ODBC Driver 17 for SQL Server};Server=#####,1433;Database=###;UID=####;PWD=###’ : file not found (0) (SQLDriverConnect)”) (Background on this error at: http://sqlalche.me/e/dbapi
What could be the solution to this because I couldn’t find it even after googling for hours.