Join Slack
Powered by
So In the end I went with 2 sets of models, though...
# proj-architecture
s
straight-sundown-84319
03/16/2026, 3:18 PM
So In the end I went with 2 sets of models, though it pained me to do it.
q
quick-window-91705
03/16/2026, 3:22 PM
It seems the recommended solution is to use inheritance to separate models for DB and for input validation
https://sqlmodel.tiangolo.com/tutorial/fastapi/multiple-models/#multiple-models-with-inheritance
Does this seem reasonable? More workaround are mentioned here:
https://github.com/fastapi/sqlmodel/issues/52
s
straight-sundown-84319
03/16/2026, 3:24 PM
From what I remember, I think there were still issues with the custom validators when using this approach, and it didn't play well with our discriminated union at the time (Though I have since reworked that so it may no longer be a problem)
straight-sundown-84319
03/16/2026, 3:25 PM
It may still be worth a POC though
q
quick-window-91705
03/16/2026, 3:25 PM
Gotcha thanks for the context!
Open in Slack
Previous
Next