Added typecheck to sqlalchemy JSON
In sqlmodel/main.py there was missing a typecheck for the JSON type supported by sqlalchemy. So it was not possible to define a model with a JSON field.
please add JSONB support too
Ah, never mind. Found a fix:
from sqlmodel import SQLModel, Field, JSON
class User(SQLModel, table=True):
id: int = Field(..., primary_key=True)
data: JSON = Field(default={}, sa_type=JSON)
Hi @vduseev @LucaGelmini is there an update on when this can be merged?
As I see this can be merged right now. The JSON compatibility was supported by SQLAlchemy, just that it wasn't implemented inside the SQLModel map of the SQLAlchemy types. So, I just changed two lines to include the JSON class 😂. Very straightforward change.
First collaboration in a repo though, so if I'm missing something please tell me 🫡
Really want this to be merged 🙏