The correct answer, provided by the author of SQLModel is:
Use a model for data validation (table=False
) and create a model for SQL by inheriting the data validation model adding table=True
.
Then after validation, copy data from data validation model to SQL model.
Full answer here: https://github.com/fastapi/sqlmodel/issues/52#issuecomment-1311987732