我想通过在多个条件下连接多个表来选择行。。。但它失败了。
PonyORM
似乎限制了“if语句”中条件的数量。你知道吗
繁殖埃斯托尔.py/test_查询(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
,它失败了反编译.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'
编辑:作为一种解决方法,我们可以通过添加来拆分查询
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')
是这个bug导致了python3.6中新的字节码。我们刚刚发布了fix on github。你知道吗
相关问题 更多 >
编程相关推荐