79092978

Date: 2024-10-16 07:55:28
Score: 2
Natty:
Report link

I needed to set the JSON column as a mutable.

the updated model would be:

class Organization(SQLModel, table=True):
    __tablename__ = "organizations"
    id: int | None = Field(default=None, primary_key=True)
    name: str = Field()
    meta: dict = Field(sa_type=MutableDict.as_mutable(JSON))

ref: section on "Detecting Changes in JSON columns when using the ORM" in the sqlalchemy docs

Reasons:
  • Blacklisted phrase (0.5): I need
  • Probably link only (1):
  • Low length (0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
Posted by: otaku