您可能需要将
schema参数传递给
sqlalchemy.schema.Table。当将声明性基础用于ORM映射时,可以通过
__table_args__类上的属性提供此额外参数。
class Entity2(base): __tablename__ = 'entity2' ## I tried combination of <db>.<table> with no success __table_args__ = {'schema': 'db2'} entity2_id = Column(Integer, primary_key=True)class Entity1(base): __tablename__ = 'entity1' ## I tried combination of <db>.<table> with no success __table_args__ = {'schema': 'db1'} entity1_id = Column(Integer, primary_key=True) entity2_id = Column(Integer, ForeignKey(Entity2.entity2_id)) entity2 = relationship('Entity2')
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)