You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"When I inherit an ORM model that contains fields of type list or dict, I encounter the error <class 'list'> has no matching SQLAlchemy type. Why does this happen?"
#1346
Traceback (most recent call last):
File "/home/coke/.config/JetBrains/PyCharm2024.3/scratches/test.py", line 8, in
class DerivedItem(BaseItem):
File "/home/coke/PythonProject/Async-FastAPI-MultiDB/.venv/lib/python3.12/site-packages/sqlmodel/main.py", line 562, in new
col = get_column_from_field(v)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/coke/PythonProject/Async-FastAPI-MultiDB/.venv/lib/python3.12/site-packages/sqlmodel/main.py", line 711, in get_column_from_field
sa_type = get_sqlalchemy_type(field)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/coke/PythonProject/Async-FastAPI-MultiDB/.venv/lib/python3.12/site-packages/sqlmodel/main.py", line 700, in get_sqlalchemy_type
raise ValueError(f"{type_} has no matching SQLAlchemy type")
ValueError: <class 'list'> has no matching SQLAlchemy type
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
First Check
Commit to Help
Example Code
Description
Traceback (most recent call last):
File "/home/coke/.config/JetBrains/PyCharm2024.3/scratches/test.py", line 8, in
class DerivedItem(BaseItem):
File "/home/coke/PythonProject/Async-FastAPI-MultiDB/.venv/lib/python3.12/site-packages/sqlmodel/main.py", line 562, in new
col = get_column_from_field(v)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/coke/PythonProject/Async-FastAPI-MultiDB/.venv/lib/python3.12/site-packages/sqlmodel/main.py", line 711, in get_column_from_field
sa_type = get_sqlalchemy_type(field)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/coke/PythonProject/Async-FastAPI-MultiDB/.venv/lib/python3.12/site-packages/sqlmodel/main.py", line 700, in get_sqlalchemy_type
raise ValueError(f"{type_} has no matching SQLAlchemy type")
ValueError: <class 'list'> has no matching SQLAlchemy type
Operating System
Linux
Operating System Details
No response
SQLModel Version
0.0.24
Python Version
3.12
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions