0

I have SQL Server 2014 (v12.0.2000.8) and I want to auto update a table via panda dataframe.

As I understood, it can be done from sqlalchemy and looks something like this:

sqlalchemy.create_engine("mssql+pyodbc://<username>:<password>@<dsnname>")

Server is on my local machine and I have windows authentication (Windows 10 to be precise).

Can someone advice me which string should be used in this situation?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

0

I have found an answer on following page (similar question) :

[https://stackoverflow.com/questions/24085352/how-do-i-connect-to-sql-server-via-sqlalchemy-using-windows-authentication][1] and string looks something like this:

sqlcon = create_engine('mssql+pyodbc://@' + 'server_name' + '/' + 'db_name' + '?trusted_connection=yes&driver=ODBC+Driver+13+for+SQL+Server')

After that we can use dataframe.tosql method to import from panda to MS SQL database.