On Jun 4, 2013, at 11:41 AM, Ladislav Lenart <lenart...@volny.cz> wrote:
> Hello. > >> You will then get the wrong results. The docstring tries to explain this - >> a joinedload uses a JOIN. For each "cls" instance, there are many rows, one >> for each "bar". If you cut off the results in the middle of populating that >> collection, the collection is incomplete, you'll see the wrong collection on >> your cls.bars. On the next load, cls.bars will be wiped out and populated >> with the remaining "bar" objects. > > Ok, I think I understand this too. > > I've tried WindowedRangeQuery. It looked promising at first but it is (much) > slower than yield_per() with all its quirks, at least for my usecase. OK, but with yield_per() you want to use eagerloading also, so yield_per() not fast enough either, I guess.... > If I > understand the WindowedRangeQuery recipe, it does a full scan of the target > table first to read all the ids and calculate the bounds of all the windows. I > don't want to it like this. I am working with relatively large datasets but it > is still far less than all rows in the table. Something like 10-50000 rows > from > a table with 1-2 million rows. The windowed query iterates over many > completely > empty windows. > > Can I modify the recipe so it preserves the filtering and creates windows only > for the interesting subset of the table? Absolutely, you should do whatever you have to in order to get the range you want, in fact the recipe even says this: Enhance this yourself ! Add a "where" argument so that windows of just a subset of rows can be computed. if your situation is even simpler than that, such as just querying from PKs 50-1000, you could just make up your own integer ranges within those two endpoints. -- 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.