首页 > 使用Flask-SQLAlchemy时一对多、多对多碰到NoForeignKeysError错误

使用Flask-SQLAlchemy时一对多、多对多碰到NoForeignKeysError错误

提示错误:

sqlalchemy.exc.NoForeignKeysError: Could not determine join condition between parent/child tables on relationship Answer.answer_collection - there are no foreign keys linking these tables via secondary table 'answers_collections'.  Ensure that referencing columns are associated with a ForeignKey or ForeignKeyConstraint, or specify 'primaryjoin' and 'secondaryjoin' expressions.

自己解决了,运行文件中没有导入的缘故。

【热门文章】
【热门文章】