Adding OR (<multiple filters>) with do_orm_execute

8 views
Skip to first unread message

Val Huber

unread,
Jan 11, 2023, 11:26:33 PM1/11/23
to sqlalchemy
I am using this and it is working well to AND a series of filters to a statement.

But I do not see how to OR these into the original statement.

For example, I have filters f1 and f2.  I want the result to be:

where <original-statement> AND (f1 OR f2).

Thanks in advance,
Val

Mike Bayer

unread,
Jan 12, 2023, 9:35:55 AM1/12/23
to noreply-spamdigest via sqlalchemy
if you have a select() construct, you can add new AND things just calling .where() again.      e.g. existing_statement.where(or_(f1, f2)) .
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
 
 
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages