minor_contains = db.Table('minor_contains', db.Column('parent_id', db.
    Integer, db.ForeignKey('minors.id'), primary_key=True), db.Column(
    'contains_id', db.Integer, db.ForeignKey('minors.id'), primary_key=True))


class Minor(db.Model):
    __tablename__ = 'minors'
id = db.Column(db.Integer, primary_key=True)
self referential many to many flask-sqlalchemy