I\'ve been wading through many website to try to understand what\'s going on, but I really need some direct help. I\'m sorry if I missed something obvious in the docs.
cascades go from owning parent to child object that gets deleted, so User.user_to_groups, Group.group_to_user:
class UserToGroup(Base):
__tablename__ = 'user_to_group'
user_login = Column(String(60), ForeignKey(User.login), primary_key=True)
group_name = Column(String(100), ForeignKey(Group.name), primary_key=True)
user = relationship(User, backref=backref('user_to_groups', cascade='all, delete-orphan'))
group = relationship(Group, backref=backref('group_to_user', cascade='all, delete-orphan'))