Thanks Conor. It works like a charm. You gave me a lot of insight in using sqla more flexible. Up to now I'm having very long statements but your way is much more self- explanatory than my own long versions.
I didn't now the yield_per. Why is it only for non-MySQL databases? On Apr 13, 8:30 pm, Conor <conor.edward.da...@gmail.com> wrote: > > Is this what you want? The query below ORs all your term clauses > together, so it has the effect of merging the results. > > clauses = [] > for term in terms: > clauses.append(table.logtext.like(term)) > clauses.append(table.titlelog.like(term)) > > q = session.query(table) > if len(clauses) > 0: > q = q.filter(or_(*clauses)) > q = q.order_by(desc(table.unixtime)) > # Reduce client memory usage for non-MySQL databases. > q = q.yield_per(1000) > for instance in q: > ... > > -Conor -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@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.