Skip to content
Discussion options

You must be logged in to vote

Thanks for your answer. If we only use class User,it works well. But if we declare a class UserInfo extend from class User, the error still exist:

from sqlmodel import (
    SQLModel,
    Field,
    JSON,
)


class User(SQLModel, table=True):
    __tablename__ = "t_user"
    id: int = Field(primary_key=True)
    num_list: list = Field(default=[], sa_type=JSON)


class UserInfo(User, table=False):
    info: str | None = Field(default="")

ValueError: <class 'list'> has no matching SQLAlchemy type

Oh, I missed your point. The output shows it is an error of inheriting from the database model.

I did meet this bug before, then I solve it by not inherit from the database model.

I split the mod…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@vlavorini
Comment options

@Ka2e
Comment options

@KunxiSun
Comment options

Answer selected by YuriiMotov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
3 participants