This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Working with JSON fields in Postgres (using SQLAlchemy and Pydantic) #2284
Labels
You can continue the conversation there. Go to discussion →
First check
Question
I tried to create a rest API with FastAPI using Postgres. I used SQLAlchemy ORM with Alembic for migrations. With Pydantic I create a schema and I used
JSON
field first. When I received a 422 error I trieddict
as JSON becomes a dictionary while while working on the data in Python.Then I received an error saying that the `table' was not found and I also found the table wasn't created (I use Alembic)
Here's the ORM model (model.py)
And here's the schema
The request body would be,
Description
Environment
OS: macOS
FastAPI Version: 0.49.2
Python version: 3.7.9
Additional context
Since a single row will have multiple processes updating info on each API calls, the column needs to be a JSON field so that for each instance would be updated as key:value pairs. I could maybe go with with NoSQL systems like Mongo. But Postgres seems a better option to me.
Any help appreciated! Thanks!
The text was updated successfully, but these errors were encountered: