use query.join(). its in the ORM tutorial. Sean wrote: > > I have a relatively, (at least I think), straightforward question that > I've been having a difficult time tracking down an answer to. > > I have Groups that have Users that have Tasks and I want to write one > query that gives me the group's users, and each user's incomplete > tasks. > > Is there a common idiom for accomplishing this? > > I was expecting there would be a way for me to do this by eagerloading > User.tasks and then applying a filter, but I haven't found anything > like this in the documentation. Another thought was I could write a > query that returned tuples like (User, [task, task, task]), with the > tasks being incomplete tasks of the user. I can write the sql for this > scenario easily, I just want a way to neatly map it to python objects. > I'm pretty sure I could figure out how to accomplish this in the > mapper. but I would prefer to do this with a query > > I'm sure this is easy. Apologies if this question is answered > somewhere in the documentation, I just couldn't find it there and > Google wasn't too helpful. > > - Sean > > > >
--~--~---------~--~----~------------~-------~--~----~ 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 sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---