我猜你会犯这样的错误
Could not determine join condition between parent/child tables...
在这种情况下,将映射器更改为
Group_To_Group
mapper(Group_To_Group, t_group_groups, properties={
'parent_group':relationship(Group,
primaryjoin=(t_group_groups.c.parent_group_id==t_groups.c.id),),
'child_group':relationship(Group,
primaryjoin=(t_group_groups.c.child_group_id==t_groups.c.id),),
})
另外,您可能需要添加
backref
这样你就可以从
Group
对象也是。