I would like to accomplish something like an SQL 'IN' condition for the where clause in Python's Peewee ORM.
Order.select().where(Order.statusid in statuses)
Is this possible?
I am using Postgres in case there is any compatibility issues with any proposed solution.
This works too:
Order.select().where(Order.statusid << statuses)
More elegant than the actual .in_ method :)
Looking at the documentation found out that there a specific query operations for IN lookup: .in_(value)
So I guess this is how it would actually work:
Order.select().where(Order.statusid.in_(statuses))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.