On Sun, May 27, 2012 at 4:37 PM, Julien Lacroix <ne...@aradriel.de> wrote: > I've stumbled across someof my old query and got certain problems to read my > bunch of where statements. > The editors word wrap function makes things just worse. whats your advance > to keep long filter statements readable, > one where statement per line would be great. > > e.g.: > obj = dbObj.query(table).filter(table.foo1 == False AND <include more filter > statements here>).order_by(table.foo2).all() >
I tend to write my SA queries like this: obj = (session.query(dbObj) .filter(dbObj.foo1 == False) .filter(sa.or_(dbObj.foo2 == 'abc', dbObj.foo3 == 'def')) .order_by(dbObj.foo2) .all()) Remember multiple filter clauses are automatically AND-ed together. Simon -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.