Replies: 3 comments 1 reply
-
Hi @emilhe, I'am encountering the same problem as you described. Where you able to solve this? |
Beta Was this translation helpful? Give feedback.
-
I am facing the same issue. For now I just model_validate the field when I intend to use it. But this is a very error prone hard to maintain approach. Any help would be highly appreciated. My hunch is that I need to pass a special function to the json_deserializer param of create_engine. I am looking into it. I hope this helps someone find the necessary solution |
Beta Was this translation helpful? Give feedback.
-
I have the same issue as well, thank you @20-buck-spin for the temporary workaround |
Beta Was this translation helpful? Give feedback.
-
First Check
Commit to Help
Example Code
Description
I am trying to bind nested models to a JSON field. The serialization/deserialization process works as expected when
table=False
, but when i settable=True
, the deserialization is no longer working as intended. In both cases, the serialized form is,When
table=False
the deserialization yields,as exptected. However, when i set
table=True
, the nested model (here, theanimal
field) ends up as adict
instead of an object of the intended type (here,Cat
),I found some related discussions, #63 and #52, that indicates that this behavior may be related to issues with pydantic model validation.
Now, my question is - is there any (proper) way to mitigate this issue?
Operating System
Linux
Operating System Details
No response
SQLModel Version
0.0.18
Python Version
Python 3.12.0
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions