1.报错代码:pymssql._pymssql.OperationalError: (8632, b'Internal error: An expression services limit has been reached. Please look for potentially complex expressions in your query, and try to simplify them.DB-Lib error message 20018, severity 17:\nGeneral SQL Server error: Check messages from the SQL Server\n')
3.分析原因得出大概率是传参元组的数量过大导致报错
4.尝试只用该元组的前10值作为新元组传参测试,可以正常查询
5.尝试探索元组峰值,大概位于30000-40000之间
6.解决方法:(1)根据峰值分割元组,在限制范围内多次查询子元组后汇总数据;
(2)修改查询语句,'select * from XX where y in %s',tuple改为:
‘select * from XX where y in %s or y in %s ...or y in %s.’,tuple1,tuple2,...tupleN
(3)其他