sqlalchemy.exc.noforeignkeyserror: could not determine join condition between parent/child tables on relationship wife.wife - the

错误提示:

sqlalchemy.exc.noforeignkeyserror: could not determine join condition between parent/child tables on relationship wife.wife - there are no foreign keys linking these tables. ensure that referencing columns are associated with a foreignkey or foreignkeyconstraint, or specify a 'primaryjoin' expression.

分析过程:

我看懂了报错原因,按照网上的解决方法都试了一遍,都没有效果,人都要炸了,

最后发现:

我把代码写错地方了,放错了类,本来是给一个teacher类的设置外键,但是直接加到了wife的下面,所以一遍又一遍地检查了语法,大小写,类名,始终没有发现问题所在。

之后查错,除了看看语句本身有没有错,再看看位置写没写错吧!

posted @ 2022-10-17 02:56  胡安  阅读(292)  评论(0编辑  收藏  举报