您如何 运行 Peewee ORM 中的 OR 查询?
How do you run an OR query in Peewee ORM?
我想运行根据用户名或电子邮件地址查询用户。
我一定是遗漏了它,但我在 peewee 文档中找不到如何 运行 一个 OR
查询。你是怎么做到的?
If you want to express a complex query, use parentheses and python’s bitwise or and and operators:
>>> Tweet.select().join(User).where(
... (User.username == 'Charlie') |
... (User.username == 'Peewee Herman')
... )
我想运行根据用户名或电子邮件地址查询用户。
我一定是遗漏了它,但我在 peewee 文档中找不到如何 运行 一个 OR
查询。你是怎么做到的?
If you want to express a complex query, use parentheses and python’s bitwise or and and operators:
>>> Tweet.select().join(User).where(
... (User.username == 'Charlie') |
... (User.username == 'Peewee Herman')
... )