如何从Foreignkey字段迁移到许多烧瓶sqlachemy?

时间:2020-05-29 08:07:37

标签: flask-sqlalchemy flask-migrate

下面是我的特殊问题,以防我患有X-Y,但是如果有人可以发布如何执行此操作,则该问题会更符合要求。但是我可能犯了一个明显的错误,并且在野外也能正常工作。

我需要从外键字段迁移到多对多字段。使用flask-migrate进行了迁移;它删除了Foreignkey字段,但没有添加多对多字段,当我运行该应用程序时,我得到了

sqlalchemy.exc.InvalidRequestError: One or more mappers failed to initialize - can't proceed with initialization of other mappers. Triggering mapper: 'mapped class Model1->object2'. Original exception was: Could not determine join condition between parent/child tables on relationship Model1.contact_details - there are no foreign keys linking these tables via secondary table 'field_link_table'.  Ensure that referencing columns are associated with a ForeignKey or ForeignKeyConstraint, or specify 'primaryjoin' and 'secondaryjoin' expressions.

任何想法表示赞赏。

0 个答案:

没有答案