SQLAlchemy Relationship Filter?

According to the relationship() documentation, you can use order_by keyword argument with relationships, to set the order that will be returned. On the same page, it mentions that you can also use primaryjoin keyword argument to define extra join parameters. I think that can be used for the filter you want.


relationship() with lazy='dynamic' option gives you a query (AppenderQuery object which allows you to add/remove items), so you can .filter()/.filter_by() and .order_by() it.