You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my code, I have a generic 'Error' table that can be used by multiple systems to store details about errors. In my reproducible example, I used 'File' and 'Action' as example systems that may throw errors (and shall refer to them as 'system' from now on).
Each error can only correspond to a single file or action, however each system could have multiple errors. To maintain the generic nature of the error table I've created 1-many link tables FileError and ActionError.
How can I correctly set up their relationships? In case it helps, I don't need to be able to navigate upwards from the error (e.g. error.file), but I do need to be able to navigate downwards (file.errors).
Does back_populates always return a list when using a link table? I ask this because my systems will contain a list of errors (which I can easily set up since it directly reflects the use-case from the docs), however each error should only contain a single system.
I'm hoping I was clear enough, but let me know if I missed anything.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
First Check
Commit to Help
Example Code
Description
In my code, I have a generic 'Error' table that can be used by multiple systems to store details about errors. In my reproducible example, I used 'File' and 'Action' as example systems that may throw errors (and shall refer to them as 'system' from now on).
Each error can only correspond to a single file or action, however each system could have multiple errors. To maintain the generic nature of the error table I've created 1-many link tables FileError and ActionError.
error.file
), but I do need to be able to navigate downwards (file.errors
).I'm hoping I was clear enough, but let me know if I missed anything.
Operating System
Windows
Operating System Details
No response
SQLModel Version
0.0.8
Python Version
3.11.4
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions