Open ClayMav opened 3 months ago
I was running into the same issue and found that Pydantic's model.dict
has an exclude parameter to specify the fields to exclude. So if you are using this to limit the fields for updates in your CRUD API, you should just be able to exclude those fields before calling your ORM's upsert/update methods.
For my use case, I am using a partial model as the input type to a patch operation. I am heavily utilizing openapi schemas and want the input type to my function to contain all minus a few fields from the data model. Below is an example to demonstrate.
Ideally, I should be able to define a class or list of fields to exclude and pass that in so that I can remove those fields on all my models that I use in this way.