I\'m using declarative SQLAlchemy and I have three models: Role
, Permission
, and RolePermission
. In my Role
model, I have t
I couldn't make any of these solutions work, however I found an easier way.
from sqlalchemy.ext.declarative import declarative_base
class User(Base):
# ....
addresses = relationship("Address",
order_by="desc(Address.email)",
primaryjoin="Address.user_id==User.id")
Found here: http://docs.sqlalchemy.org/en/latest/orm/extensions/declarative/relationships.html