Skip to content

ForeignKeyViolationError in Relationship deletion #1467

Answered by antont
junoriosity asked this question in Questions
Discussion options

You must be logged in to vote

Yep it's because you have foreign_key="user.id" in Group, so you can't delete a user when a group refers to it.

You have defined cascades however, maybe it needs to be in the relationship in Group with back_populates though?

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by YuriiMotov
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested investigate
4 participants
Converted from issue

This discussion was converted from issue #457 on August 07, 2025 16:01.