SQLAlchemy - order_by on relationship for join table
I'm using declarative SQLAlchemy and I have three models: Role , Permission , and RolePermission . In my Role model, I have the following: class Role(Base): name = Column(u'NAME', VARCHAR(50), nullable=False, unique=True) permissionLinks = relationship(RolePermission, backref="role", order_by=name) permissions = relationship(Permission, backref=backref("roles", order_by=name), secondary=RolePermission.__table__, order_by=Permission.name) Now the permissions declaration works fine, and the permissions associated with a role come out sorted as I expect (by name). However, permissionLinks fails