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:
session.query(User).outerjoin(User.addresses).order_by(Users.id, 
Address.name, Address.more).options(contains_eager(User.addresses)) 

I had hoped then when I looped over each user, and then looped over 
user.addresses, I would find the addresses were sorted by (name, more). 
However, this does not seem to be the case. I have a full example here:
https://gist.github.com/bobbyi/5530250

Is there a way that I can get the objects to keep the ordering from the 
database? I want to use the collation types, etc., as defined in the 
database so I'd rather avoid sorting the items again in Python.

Thanks.

-- 
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 to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to