On Fri, Apr 26, 2013 at 12:06 PM, Werner <werner.bru...@sfr.fr> wrote: > On 26/04/2013 16:41, alonn wrote: >> >> so not to load too much into memory I should do something like: >> >> for i in session.query(someobject).filter(id>something) >> print i >> >> I'm guessing the answer is no, because of the nature of sql, but I'm not >> an expert so I'm asking. > > yes you can, check out the doc for querying, e.g. the following if you use > the ORM. > > http://sqlalchemy.readthedocs.org/en/rel_0_8/orm/tutorial.html#querying
Not entirely, if you don't use yield_per (as shown in the docs in fact, but worth mentioning). Seeing query: if self._yield_per: fetch = cursor.fetchmany(self._yield_per) if not fetch: break else: fetch = cursor.fetchall() Not only that, but also all rows are processed and saved to a local list, so all instances are built and populated way before you get the first row. That is, unless you specify yield_per. -- 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+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.