Relations and inheritance mapping
Hello! I have a schema where a question can be polymorphic - that is there's a generalized (base)
Question
that can be specialized: TrueFalseQuestion
, MultipleChoiceQuestion
etc. Specialized types have their own attributes, that are unique to them (such as is_correct
for true/false).
I would like to know if there's a way to use Drizzle Query and don't nest the associated tables, but instead return the attributes within the object itself:
Mapping it manually ofc isn't a problem. I'm just curious whethe it's possible to do it through drizzle directly?
Currently I query the data as follows:
1 Reply
I was thinking something along the lines of how the Hibernate or SQLAlchemy does the "inheritance mappings" with join table strategy
https://docs.sqlalchemy.org/en/20/orm/inheritance.html