作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这就是我所拥有的:
SomeTable.select.where(reduce(operator.or_, (SomeTable.stuff == entry for entry in big_list)))
当我在 big_list 中有一个相对较大的元素列表时,问题就出现了,我得到了这个:
RuntimeError: maximum recursion depth exceeded
是否有另一种方法可以解决这个问题,而不需要将列表分成几个 block ?
尝试使用任何建议,这是我的错误:
Traceback (most recent call last):
File "C:/Users/f9xk3li/Documents/GitHub/leoshop_web/leoshop_web/data_models/data_model.py", line 347, in <module>
search_bins_all("BoA 0")
File "C:/Users/f9xk3li/Documents/GitHub/leoshop_web/leoshop_web/data_models/data_model.py", line 179, in search_bins_all
for d in generator.order_by(SomeTable.RetrievedDate.desc()):
File "C:\Users\f9xk3li\AppData\Local\Continuum\Anaconda\lib\site-packages\peewee.py", line 282, in inner
clone = self.clone() # Assumes object implements `clone`.
File "C:\Users\f9xk3li\AppData\Local\Continuum\Anaconda\lib\site-packages\peewee.py", line 2202, in clone
return self._clone_attributes(query)
File "C:\Users\f9xk3li\AppData\Local\Continuum\Anaconda\lib\site-packages\peewee.py", line 2412, in _clone_attributes
query = super(SelectQuery, self)._clone_attributes(query)
File "C:\Users\f9xk3li\AppData\Local\Continuum\Anaconda\lib\site-packages\peewee.py", line 2206, in _clone_attributes
query._where = self._where.clone()
AttributeError: 'bool' object has no attribute 'clone'
这是代码
generator = SomeTable.select()
generator = generator.where(any(SomeTable.BIN == entry for entry in big_list))
for d in generator:
....
最佳答案
尝试...where(SomeTable.BIN.in_(big_list))
PeeWee 对于在其 where
子句中使用的内容有限制,以便与库一起使用。
http://docs.peewee-orm.com/en/latest/peewee/querying.html#query-operators
关于python - Peewee:减少条件语句在一定长度后中断的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30982571/
我正在尝试开发右边框/Angular 具有特定 Angular (30°) 的表格。我见过一些类似的解决方案,但它们都无法在一定程度上发挥作用。如果我想从 30° 改变到 20°,我不想花太多力气。
我是一名优秀的程序员,十分优秀!