背景
需要sqlalchemy连接池的功能,用于并行;
需要连接sqlserver
需要在ubuntu和windows进行操作
需要封装成库
可选方案
- pyodbc
windows下实测好用,不管是存储过程,还是多个数据库的表join查询均可; - pymssql
windows下测试不太好用,多数据库表join查询无法支持;
stackoverflow上的同样的问题无人解答
解决方案
- 安装ODBC驱动,以下可选。windows和linux均可安装。
{SQL Server} - released with SQL Server 2000
{SQL Native Client} - released with SQL Server 2005 (also known as version 9.0)
{SQL Server Native Client 10.0} - released with SQL Server 2008
{SQL Server Native Client 11.0} - released with SQL Server 2012
{ODBC Driver 11 for SQL Server} - supports SQL Server 2005 through 2014
{ODBC Driver 13 for SQL Server} - supports SQL Server 2005 through 2016
{ODBC Driver 13.1 for SQL Server} - supports SQL Server 2008 through 2016
{ODBC Driver 17 for SQL Server} - supports SQL Server 2008 through 2019 - 使用pyodbc + sqlalchemy创建数据库连接池进行封装。