Юрий Пайков <dia...@cry5tal.in> wrote:
> Well, I added "echo=True" and saw the queries - no additional were made. > Then I added > populate_existing() > > and out of the blue I started to get the desired result, but frankly I don't > quite understand why. What side-effects this could bring? it means the parent records in question were already loaded, and already present in the identity map for your session - the collections were there already, and the contains_eager had no effect on their contents. > > > суббота, 31 января 2015 г., 21:22:08 UTC+5 пользователь Michael Bayer написал: > > Anyway, yes, contains_eager says, “populate these collections”. the usage > looks correct, so the echo=True, or even echo=‘debug’ which will show you the > result rows coming in, will show you where its going wrong. > > or if those collections were already populated previously within that > Session, that would affect it also. you can say query.populate_existing() > to force it to re-load everything. > > > and out of the blue I started to get the desired result, but frankly I don't > quite understand why > > > суббота, 31 января 2015 г., 21:22:08 UTC+5 пользователь Michael Bayer написал: > > Anyway, yes, contains_eager says, “populate these collections”. the usage > looks correct, so the echo=True, or even echo=‘debug’ which will show you the > result rows coming in, will show you where its going wrong. > > or if those collections were already populated previously within that > Session, that would affect it also. you can say query.populate_existing() > to force it to re-load everything. > > > > -- > 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. > For more options, visit https://groups.google.com/d/optout. -- 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. For more options, visit https://groups.google.com/d/optout.