Hello,
I know that it is possible to convert to Pydantic models using the method from_orm().
However, I don't find anywhere information about doing the opposite way, i.e. converting Pydantic models to ORM classes (something like to_orm()).
Is there a simple way to accomplish this? For example, in my case I have a lot of nested models (models which contain lists of other models) and I want to convert to my business objects.
Thanks!
The general approach is to use something like MyOrmModel(**my_pydantic_model.dict()).
Any other solution would either require specific integration with an ORM or would need to be implemented in the other model.
Thank you for the answer.
Most helpful comment
The general approach is to use something like
MyOrmModel(**my_pydantic_model.dict()).Any other solution would either require specific integration with an ORM or would need to be implemented in the other model.