Subclass identification error on a one to one relationship. #1300
Unanswered
Lolozendev
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
-
First Check
Commit to Help
Example Code
We wanted to be as close as possible to this scenario, even if it's not the best way to do it with sql:
Description
We have a User class with an Id and a name.To represent whether this user is a “Streamer” or a “Habitue”, we've defined two other classes with their own attributes.
For us, a “User” has the optional ability to be a “Habitue” (A "Habitue" has a color) and/or a “Streamer” (a "Streamer" has a url). We therefore try to represent this link between a basic “User” and its advanced versions via a One-to-One relationship.
We realize that at runtime, a type comparison is made. The “Streamer” and “Habitue” classes are not recognized as subclasses of the SQLModel type, but as Enums.As a result, we are unable to establish this One-to-One relationship.
To try to solve this, we tried the recommendations provided in:
Operating System
Linux
Operating System Details
I'm running it in a python3.13 image docker
SQLModel Version
0.0.22
Python Version
Python 3.13.2
Additional Context
Full StackTrace:
Beta Was this translation helpful? Give feedback.
All reactions