Flask App-Builder 和多对多的关系?

Flask App-Builder and many to many relation?

我 运行 在尝试实现多对多关系时遇到以下错误:
Was unable to import app Error: Neither 'Column' object nor 'Comparator' object has an attribute 'schema'

这是我的代码:

association_table = Table('association',
    Column('geo_idx', Integer, ForeignKey('geo.idx')),
    Column('container_idx', Integer, ForeignKey('container.idx'))
)


class Geo(Model):
    idx = Column(Integer, unique=True, primary_key=True)
    name = Column(String(64), unique=True, primary_key=False)
    containers = relationship("Container",
                             secondary=association_table, lazy = "subquery",
                             backref=backref('geos', lazy=True))

    def __repr__(self):
        return self.name


class Container(Model):
    idx = Column(Integer, unique=True, primary_key=True)
    name = Column(String(64), unique=True, primary_key=False)

    def __repr__(self):
        return self.name

我做了一些谷歌搜索,大多数遇到此错误的人都是因为没有将列大写而得到它的,但是在这种情况下情况并非如此。任何指针将不胜感激。

设法通过将 Model.metadata 传递给关联 table 创建函数使其工作。

association_table = Table('association', Model.metadata,
    Column('geo_idx', Integer, ForeignKey('geo.idx')),
    Column('container_idx', Integer, ForeignKey('container.idx'))
)