I need to change a collection order_by when a parent instance mapped attribute changes.
Something like this: parents = Table('parents', metadata, Column('id', Integer, primary_key=True) Column('reverse', Boolean, primary_key=True) ) items = Table('items', metadata, Column('id', Integer, primary_key=True) ) .... mapper(parents, Parent, properties={ 'items': relationship(Item, backref='parent', collection_class=ItemsList, order_by=items.c.id ) } >>> parent = session.query(Parent).first() >>> parent.reverse False >>> parent.items [<Item 1>, <Item 2>, <Item 3>] >>> parent.reverse = True >>> parent.items [<Item 3>, <Item 2>, <Item 1>] I already use a custom collection and I could make custom __iter__ according to first item (if any) `self.parent.reverse` but it seems to me a bit too tricky. Any advice? Thank you for your support -- 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.