On 6月23日, 上午12时45分, Michael Bayer <[EMAIL PROTECTED]> wrote:
> its correct. the LEFT OUTER JOINs above are the result of the > lazy=False eager load you have switched on...if you set lazy=True, you > will see the actual statement you are creating via your Query. > Because the OUTER JOIN tables are aliased, they have no bearing upon > the entity rows (that is, person rows), that are selected. to join > to the "address" table for the purposes of limiting "person" rows > based on "address", you have to tell Query what you want to join to: > > persons = > session.query(Person).join('addresses').select(address.c.street=='mystreet') > > try it first without the eager load to see what you get, then turn on > eager loading so you can see the difference. Thanks for the explanation. Now I understand. With eager loading turned on, the query has 2 joins and 2 left joins. Though a bit complex, I guess it is actually exactly what is needed. Best Regards Hong Yuan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---