使用sqlalchemy连接mssql

安装pyodbc

pip install pyodbc -i https://pypi.tuna.tsinghua.edu.cn/simple

创建连接

engine=create_engine("mssql+pyodbc://sa:")conn = engine.connect()

查询

from sqlalchemy.sql import select
s = select([users])
result = conn.execute(s)

参考:

https://blog.csdn.net/qq_43355223/article/details/82997175

相关推荐