Re: [sqlalchemy] contains_eager and ordering

2013-05-07 Thread Bobby Impollonia
Thanks! Expiring the collection before querying worked. The orderinglist extension looks interesting as well. My current use case is that I wanted to apply the ordering on a per-query basis, so I was specifically looking for a solution that didn't involve changing the relationship definition, h

Re: [sqlalchemy] contains_eager and ordering

2013-05-07 Thread Michael Bayer
the User.addresses collection will not refresh itself unless the collection is expired. At the point of your flush, each User.addresses is already populated with the unordered Address objects.If you either Session.commit(), or Session.expire_all(), or Session.expire(user, ['addresses']), t

[sqlalchemy] contains_eager and ordering

2013-05-06 Thread Bobby Impollonia
I am executing a query with contains_eager to load objects and their related objects from a different table. I would like to control the order of the related objects within each InstrumentedList. I had hoped this could be done through the ordering in the query. For example, with a query like: s