SQLAlchemy connects to SQLServer using Windows Authenticaton with pymssql driver

两盒软妹~` 提交于 2020-01-05 07:55:09

问题


I can use pymssql to connect to SQLServer using Windows Authentication:

conn = pymssql.connect(host='..', database='..', trusted=True)

But how could I use SQLAlchemy to connect to SQLServer using Windows Authenticaton with pymssql driver?

The example given by SQLAlchemy is:

mssql+pymssql://<username>:<password>@<freetds_name>

Since I use Windows Authentication, I cannot manually set the username and password.


回答1:


I do not have pymssql to check, but try the version below:

mssql+pymssql://<freetds_name>?trusted=True


来源:https://stackoverflow.com/questions/8284181/sqlalchemy-connects-to-sqlserver-using-windows-authenticaton-with-pymssql-driver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!