How to implement a junction/association table with multiple relationships #792
Unanswered
franTarkenton
asked this question in
Questions
Replies: 1 comment
-
@franTarkenton Were you ever able to figure it out? I have the same usecase. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First Check
Commit to Help
Example Code
Description
In summary this is what I'm trying to implement:
I copied the example from many to many page and modified it to add the position table. What I want is the junction table to manage the relationship of pairs of team/position.
Unfortunately when I try to do something like:
I get integrity constraints because its trying add to one of the related tables at a time. You can see in the example code how I am working around this by:
team_preventers.id
andteam_position_member.id
hero_team_link
Is this the best way?
Operating System
Linux
Operating System Details
No response
SQLModel Version
0.0.14
Python Version
3.11.7
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions