FlaskSQL炼金术,多对多关系出错

2024-05-29 04:25:42 发布

您现在位置:Python中文网/ 问答频道 /正文

尝试创建以下数据库时出错:

File "XXXXX/flask/lib/python2.7/site-packages/sqlalchemy/orm/relationships.py", line 1987, in _determine_joins
    "expressions." % (self.prop, self.secondary)) NoForeignKeysError: Could not determine join condition between parent/child tables on relationship PostReply.tags - there are no foreign keys linking these tables via secondary table 'postReplyTags'.  Ensure that referencing columns are associated with a ForeignKey or ForeignKeyConstraint, or specify 'primaryjoin' and 'secondaryjoin' expressions.

关于这个数据库和相关部分的更多信息。它有posts和post-replies,这两个都可以添加标签。在

其设置如下:

^{pr2}$

奇怪的是,所有的帖子都能正常工作,而帖子回复却不行。有谁能帮我弄清楚为什么会这样吗?这是标签和帖子/帖子回复的多对多关系?非常感谢!在


Tags: orself数据库flasktableslibsite标签

热门问题