从 python 3.7.1 升级到 python 3.8.5 后,发现以下两个问题:
- 直接通过 pymssql 模块查询 mssql 数据库,返回结果集的中文全是乱码,但字段名中的中文不会乱码;
- 通过 records 模块查询 mssql 数据库,返回结果集为空列表;
查 pymssql 最新版本为 2.1.4,发布于 2018 年 8 月 29 号,支持到 python 3.7(参考)
猜测上述两个问题可能是 pymssql 未兼容 python 3.8 导致的,暂时无解。
想起在 python 3.7.1 环境下导入 pymssql 时,会有如下警告信息:
DeprecationWarning: Using or importing the ABCs from ‘collections’ instead of from ‘collections.abc’ is deprecated, and in 3.8 it will stop working
也许跟这个有关。