On Sep 26, 2013, at 9:30 AM, Ladislav Lenart <lenart...@volny.cz> wrote:
> > Your thoughts on this? Do you see anything suspicious? > > BTW the new system for 0.9 looks very nice! OK I only started reading the first few queries, but immediately what I think is causing confusion here is that your loading options are conflicting with each other, so the joinedload() you're looking for at the top is being partially cancelled out: session.query(Partner).filter( Partner.id.in_(win) ).options( joinedload(Partner.subject, innerjoin=True), joinedload(Partner.subject, Subject.subject_personal, innerjoin=True), joinedload(Partner.subject, Subject.subject_personal, SubjectPersonal.address), subqueryload(Partner.subject, Subject.contacts), subqueryload(Partner.subject, Subject.contacts, Contact.contact_personal), subqueryload(Partner.subject, Subject.contacts, Contact.contact_personal, ContactPersonal.contact_address), subqueryload(Partner.subject, Subject.contacts, Contact.contact_personal, ContactPersonal.permanent_address), subqueryload_all(Partner.subject, Subject.tag_subjects, TagSubject.tag), subqueryload_all(Partner.partner_regions), ) the directive subqueryload_all(Partner.subject, Subject.tag_subjects, TagSubject.tag) is after the joinedloads you have above, so the joinedload(Partner.subject) is cancelled out by that, hence all the additional joinedload() that build on top of that is pushed out to be part of the subqueryloads. you can read these directives just like paths. The "path" is a unique key in a dictionary. as the loading traverses along each relationship, it looks up the path, and the kind of loader called for. the above is the equivalent of: joined -> /subject/ joined -> /subject/subject_personal/ joined -> /subject/subject_personal/address/ subqry -> /subject/contacts/ subqry -> /subject/contacts/contact_personal/ subqry -> /subject/contacts/contact_personal/contact_address/ subqry -> /subject/contacts/contact_personal/permanent_address/ subqry -> /subject/ (overrides the joined) subqry -> /subject/tag_subjects/ subqry -> /subject/tag_subjects/tag/ subqry -> /partner_regions/
signature.asc
Description: Message signed with OpenPGP using GPGMail