On Fri, Jan 04, 2008 at 05:55:21PM +0100, Felix Schwarz wrote:
> I noticed that SQLAlchemy 0.4.2 generates invalid SQL queries if
> I use or_() [without parameters] in a filter condition:
> or_conditions = []
> condition = and_(User.c.name=="John", or_(*or_conditions))
> query = session.query(User).filter(condition)
Since you can chain filters together I'd suggest something like:
query = session.query(User).filter(User.c.name=="John")
if or_conditions:
query = query.filter(or_(*or_conditions))
Cheers
Christoph
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---