I am trying to run the code below.
import pandas as pd
from sqlalchemy import create_engine
import urllib
#import pyodbc
params = urllib.parse.quote_plus("DRIVER='{ODBC Driver 17 for SQL Server}';SERVER=server.database.windows.net;DATABASE=my_db;UID=my_id;PWD=my_pwd")
myeng = sqlalchemy.create_engine("mssql+pyodbc:///?odbc_connect=%s" % params)
df.to_sql(name="dbo.my_table_name", con=myeng, if_exists='append', index=False)
I get an error when I hit the last line of code. I am getting this error.
DBAPIError: (pyodbc.Error) ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib ''{ODBC Driver 17 for SQL Server}'' : file not found (0) (SQLDriverConnect)")
I am reading through the documentation here.
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_sql.html
Everything pretty much makes sense to me, but I'm not sure how to reference the SQL Server driver. When I look at the DOBC setup on my laptop, I see this.
I think this is ok, but I'm actually pushing data to an Azure Data Warehouse (on a server machine, not my local machine). I'm not sure how to check the driver on that DB sitting on the server. Also, I'm not totally sure, but the problem seems to come from either the DRIVER or the SERVER. Basically, I am just looking for some guidance as to how to make this work. Thanks!