我想通过在多个条件下连接几个表来选择行.结果失败了。PonyORM似乎限制了"if语句“中的条件数。
要在estore.py / test_queries (PY3.6,PonyORM 0.73)中复制一个愚蠢的示例:
result = select(c for c Customer if c.country!='A' and c.country!='A' and c.country!='A' and c.country!='A' and c.country!='A' and ...)如果是Nbr of c.country! = 'A' <= 24,它可以工作,但是>= 25在decompiling.py中失败了
如何绕过这个限制,对于有很多表和条件的查询来说很烦人?
Traceback
<module> site-packages\pony\orm\examples\estore.py 183
test_queries <string> 2
new_func site-packages\pony\orm\core.py 460
test_queries site-packages\pony\orm\examples\estore.py 169
select <string> 2
cut_traceback site-packages\pony\utils\utils.py 58
select site-packages\pony\orm\core.py 5160
make_query site-packages\pony\orm\core.py 5147
decompile site-packages\pony\orm\decompiling.py 32
__init__ site-packages\pony\orm\decompiling.py 72
decompile site-packages\pony\orm\decompiling.py 90
TypeError: unsupported operand type(s) for <<: 'list' and 'int' 编辑:作为解决办法,我们可以通过添加.where来拆分查询
result = select(c for c Customer if c.country!='A' and c.country!='A' and c.country!='A' and c.country!='A' and c.country!='A').where(lambda c:c.country!='A' and c.country!='A')发布于 2018-06-22 15:17:43
正是这个bug导致了Python3.6中的新字节码。我们刚刚发布了修正github。
https://stackoverflow.com/questions/49752761
复制相似问题