SQLAlchemy ManyToMany secondary table with additional fields
I have 3 tables: User, Community, community_members (for relationship many2many of users and community). I create this tables using Flask-SQLAlchemy: community_members = db.Table('community_members', db.Column('user_id', db.Integer, db.ForeignKey('user.id')), db.Column('community_id', db.Integer, db.ForeignKey('community.id')), ) class Community(db.Model): __tablename__ = 'community' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(100), nullable=False, unique=True) members = db.relationship(User, secondary=community_members, backref=db.backref('community_members', lazy=