python - Peewee 的 Where 子句中的 IN 条件

标签 python postgresql python-2.7 orm peewee

我想为 Python 的 Peewee ORM 中的 where 子句完成类似于 SQL“IN”条件的操作。

Order.select().where(Order.statusid in statuses)

这可能吗?

我正在使用 Postgres,以防与任何建议的解决方案存在任何兼容性问题。

最佳答案

这也行:

Order.select().where(Order.statusid << statuses)

比实际的 .in_ 方法更优雅:)

关于python - Peewee 的 Where 子句中的 IN 条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30605045/

相关文章:

python - 当我进行聚合查询时,Django 模型管理器无法处理相关对象

node.js - Sequelize : join three tables

python - 将 Tkinter 复选按钮文本字符向左对齐

当计数高于阈值时,Python 计算字典理解中的元素

python - PYCHARM导入caffe报错

python - MemoryError : Unable to allocate array with shape (2515, 406272) 和数据类型 float32

python - GAE 数据存储使用 Python 过滤不返回任何数据

sql - 在 PostgreSQL 中查找比较 2 个字段的重复项

Python 脚本在 Ubuntu 12.04 中被杀死

插入时出现 PostgreSQL BIGSERIAL 和 "duplicate key"