import sqlalchemy import pyodbc engine = sqlalchemy.create_engine("mssql+pyodbc://<username>:<password>@<dsnname>") # write the DataFrame to a table in the sql database df.to_sql("table_name", engine)