Create data for 1-M or M-M relatationship using List of IDs rather than List of objects #562
Unanswered
petercinibulk
asked this question in
Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Example Code
Description
I posted this issue a while back #124 which I am basically asking again here. I originally closed the issue as that answer sufficed but now it recently resurfaced. One of the strong features of SQLModel is the relationship with pydantic. I use a lot of CRUD base models to automatically create CRUD operations for me. An example of this would be a more abstract version of the create_team function above. In the above example, something I want to be able to have TeamCreate model and create a Team entry using hero_ids instead of heroes.
A workaround is to manually load the heroes from their ids but then I would need another model inorder to have the create_team function work
Operating System
Linux
Operating System Details
Ubuntu
SQLModel Version
0.0.8
Python Version
Python 3.11.2
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions