Re: [sqlalchemy] contains_eager does not load relation data if related model appears twice in query

2015-05-25 Thread Alex S
Thank you very much for your work, Mike. -- 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

[sqlalchemy] contains_eager does not load relation data if related model appears twice in query

2015-05-23 Thread Alex S
Hi everyone! I've found that contains_eager() does not load relation objects from query in case when related model appears twice in query. The working code with example models and steps to reproduce is listed in the attached file, I'll briefly describe the issue here. There are four models:

Re: [sqlalchemy] contains_eager does not load relation data if related model appears twice in query

2015-05-23 Thread Mike Bayer
On 5/23/15 5:45 PM, Alex S wrote: When I start printing some user's relations (u.preferences or u.accounts), I've found that all data was load via q.all() call and there are no additional queries in database. All data are loaded except for u.preferences.current_account.preferences. Account

Re: [sqlalchemy] contains_eager does not load relation data if related model appears twice in query

2015-05-23 Thread Mike Bayer
On 5/23/15 9:01 PM, Mike Bayer wrote: The best I can do is that there's a patch that can make this work but I definitely cannot commit it in 1.0; the eager loading mechanics are extremely sensitive and easily messed up by even the most subtle change, and I'd have to find time to think and