What is the purpose of parse_obj's second argument: "update"? #1461
-
First Check
Commit to Help
Example CodeSomeModel.parse_obj({"one": 2}, {"three": 4}) DescriptionSQLModel's Could someone explain why it was added? What was the actual use case? I understand what it does, but I don't understand why it does it. Operating SystemLinux, Windows, macOS, Other Operating System DetailsNo response SQLModel Version0.0.8 Python Version3.11 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I'm using it in from_orm when get some parameters to create a new object in an API call from a client, but then add more values to the DB type using some logic in my endpoint function. So am doing this: |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
See https://sqlmodel.tiangolo.com/tutorial/fastapi/update-extra-data/#create-a-model-object-with-extra-data