Search code examples
pythonpostgresqlpython-2.7ormpeewee

IN condition in Where clause on Peewee


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.


Solution

  • 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))