Ah, sorry about that. I (almost) always nest "or_" in "and_". I don't
think I've ever done the inverse!
--
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
Yeah that almost works. I needed to add an and_ around each of the
subclauses, otherwise the or_ breaks.
abcd = or_(and_(table.col_1 == a, table.col_2 == b),
and_(table.col_1 == b, table.col_2 == c))
For posterity, to loop over my rows I found I could put it in a generator
over the
Are you looking for the `or_`
from sqlalchemy.sql import and_, or_
abcd = or_((table.col_1 == a, table.col_2 == b),
(table.col_1 == b, table.col_2 == c),
)
session.query(table).filter(**abcd).all()
that should generate something like
SELECT * FROM table WHERE (col_1 == a and col_2 ==