好的找到了答案-
在关系http://docs.sqlalchemy.org/en/latest/orm/relationship_persistence.html#post-
update中使用post_update
所以我在 Category 类中所做的更改如下:
SortByAttribute = relationship( "Attribute", uselist=False, foreign_keys=[sortByAttribute], primaryjoin="Attribute.ID==Category.sortByAttribute")
对此:
SortByAttribute = relationship( "Attribute", uselist=False, foreign_keys=[sortByAttribute], primaryjoin="Attribute.ID==Category.sortByAttribute", post_update=True)



