Skip to content

Discriminated Unions Raise "Cannot have a (non-optional) union as a SQLAlchemy field" (Regression?) #1017

Closed Answered by danbreu
danbreu asked this question in Questions
Discussion options

You must be logged in to vote

This question was based on a misunderstanding of how SQLModel works. There is no way for SQLModel to automatically "collapse" nested models into a top-level table model.
And, as far as I understand, discriminated unions are only available for the Pydantic-based (i.e. non-ORM) part of SQLModel.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by danbreu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
1 participant