Hi Diana, thank you for your help, but unfortunately my problem still exists. In my case the lazy attribute for the myChildren relationship has absolutely no effect! At this point one more information is important: I build and populate the database with one session, and then open a new session and call showDatabase. If you populate the database with one session, and then call showDatabase with the same (now not empty) session, then the instances are already in the session and sqlalchemy don't fire new queries for access to the myChildren attribute of human. So, it is important to call showDatabase with an empty session to reproduce my issue.
One more information could be important: If I load a woman instance and access myChildren with: woman = session.query(Woman).one() print woman.myChildren then sqlalchemy emits an extra sql query on the access to myChildren and ignore my lazy='subquery' or lazy='joined' parameter for the mychildren relationship configuration. But if I modify the query like this: woman = session.query(Woman).options(subqueryload('myChildren')).one() print woman.myChildren then sqlalchemy load the woman and all children at once! Exactly what I need. But this makes completely no sense to me, i thought that subqueryload() just overload the load strategie for a relationship. So myChildren = relationship('Child', secondary=link_table, lazy='subquery') and subqueryload('myChildren') should be equivalent. Why is there a difference? -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/GponYdm2PLsJ. To post to this group, send email to sqlalchemy@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.