> -----Original Message----- > From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] > On Behalf Of Marc Van Olmen > Sent: 29 June 2011 04:19 > To: sqlalchemy > Subject: [sqlalchemy] In case of joinedload_all how do I order by on > a columns of those relations > > Hi > > I'm trying to order by a column from a relationship. > > Taken example from: > > http://www.sqlalchemy.org/docs/orm/loading.html#routing-explicit- > joins-statements-into-eagerly-loaded-collections > > In case of > > query.options(joinedload_all('orders.items.keywords'))... > > or > > query.options(joinedload_all(User.orders, Order.items, Item.keywords)) > > I would like to do something like: > > query.options(joinedload_all('orders.items.keywords')).order_by('user > .orders.items.keywords.name') > > > Tried this above but didn't work. Searched for some sample/tutorials > but with no luck. > > thanks for any direction. > > marc
I think this is in the FAQ: <http://www.sqlalchemy.org/trac/wiki/FAQ#ImusinglazyFalsetocreateaJOINOU TERJOINandSQLAlchemyisnotconstructingthequerywhenItrytoaddaWHEREORDERBYL IMITetc.whichreliesupontheOUTERJOIN> (That link has probably wrapped - search for ORDER BY on http://www.sqlalchemy.org/trac/wiki/FAQ) Hope that helps, Simon -- 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.