Is it possible to instantiate a SQLModel object with relationships from a dict
type?
#342
Open
8 tasks done
Labels
question
Further information is requested
First Check
Commit to Help
Example Code
Description
In Pydantic it is possible to instantiate objects directly from dicts (i.e. JSON) via
ClassName(**dict)
. This also works for objects with nested objects (i.e. relationships in SQLModel). Is it possible to do the same in SQLModel? I would like to take a JSON like{"id": 123, "relationship_obj": {"id": 456, ...}}
and have SQLModel correctly create the relationship model based on the type of the field & the key of the dict passed in.The error received is:
Operating System
Linux
Operating System Details
No response
SQLModel Version
0.0.6
Python Version
Python 3.9.5
Additional Context
No response
The text was updated successfully, but these errors were encountered: