So In the end I went with 2 sets of models, though...
# proj-architecture
s
So In the end I went with 2 sets of models, though it pained me to do it.
q
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
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)
It may still be worth a POC though
q
Gotcha thanks for the context!