Enums are not autocompleted & gives error #1489
-
First Check
Commit to Help
Example Codeclass EnumAccessStatus(Enum):
PENDING = "pending"
APPROVED = "approved"
REJECTED = "rejected"
REVOKED = "revoked"
class Temp(SQLModel):
py_type: EnumAccessStatus
access_status = Field(
sa_column=Column(
sqlAlchemyEnum(EnumAccessStatus)
)
) Description
Operating SystemLinux Operating System DetailsUbuntu 21.10 64-bit SQLModel Version0.0.6 Python Version3.10.2 Additional Context |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
As mentioned in python docs you have to inherit from both
|
Beta Was this translation helpful? Give feedback.
-
It is still not working. |
Beta Was this translation helpful? Give feedback.
-
This is because you didn't specify the type of this parameter.
access_status: EnumAccessStatus = Field(
sa_column=Column(
sqlAlchemyEnum(EnumAccessStatus)
)
) |
Beta Was this translation helpful? Give feedback.
This is because you didn't specify the type of this parameter.
sa_column
is only for SQLAlchemy. You still need to add type annotations for this field for Pydantic to be able to create the init method: