ValueError: <class 'dict'> has no matching SQLAlchemy type #1308
Unanswered
Soulbadguy54
asked this question in
Questions
Replies: 1 comment
-
Have you tried to use a generic from sqlalchemy.sql.schema import Column
from sqlalchemy.sql.sqltypes import JSON
class ModelWithGenericJsonColumn(SQLModel, table=True):
id: int = Field(primary_key=True)
d: dict[str, str] = Field(default={"key": "value"}, sa_column=Column(JSON)) Maybe would work :) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Example Code
Description
I got exactly the same error doesnt metter which way I use.
dict or Dict, or dict[str, Any] etc
MutableDict or sa_type with just JSONB or sa_column
Everytime get the same error:
Operating System
Windows
Operating System Details
No response
SQLModel Version
0.0.22
Python Version
3.12.7
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions