First Check
Commit to Help
Example Code
fromtortoise.modelsimportModelfromtortoise.fieldsimportUUIDField, DatetimeField,CharField, BooleanField, JSONField, ForeignKeyField, CharEnumField, IntFieldfromtortoise.contrib.pydanticimportpydantic_model_creatorclassSchedule(Model):
id=UUIDField(pk=True)
created_at=DatetimeField(auto_now_add=True)
modified_at=DatetimeField(auto_now=True)
case=JSONField()
type=CharEnumField(SchemasEnum,description='Schedule Types')
username=ForeignKeyField('models.Username')
description=CharField(100)
schedule_pydantic=pydantic_model_creator(Schedule,name='Schedule')Description
I have already implemented an API using FastAPI to store Pydantic Models. These models are themselves nested Pydantic models so the way they interact with a Postgres DataBase is throught JsonField. I've been using Tortoise ORM as the example shows.
Is there an equivalent model in SQLModel?
Operating System
Linux
Operating System Details
WSL 2 Ubuntu 20.04
SQLModel Version
0.0.4
Python Version
3.8
Additional Context
No response
First Check
Commit to Help
Example Code
Description
I have already implemented an API using FastAPI to store Pydantic Models. These models are themselves nested Pydantic models so the way they interact with a Postgres DataBase is throught JsonField. I've been using Tortoise ORM as the example shows.
Is there an equivalent model in SQLModel?
Operating System
Linux
Operating System Details
WSL 2 Ubuntu 20.04
SQLModel Version
0.0.4
Python Version
3.8
Additional Context
No response