First Check
Commit to Help
Example Code
from sqlmodel import SQLModel, Field, JSON, Enum, Column
from typing import Optional
from pydantic import BaseModel
from datetime import datetime
class TrainingStatus(str, enum.Enum):
scheduled_for_training = "scheduled_for_training"
training = "training"
trained = "trained"
class model_profile(SQLModel, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
training_status: Column(Enum(TrainingStatus))
model_version: str
Description
I am trying to create an enum column and use the value in the database. But I am getting this error:
RuntimeError: error checking inheritance of Column(None, Enum('scheduled_for_training', 'training', 'trained', name='trainingstatus'), table=None) (type: Column)
Does anyone knows how to help me? I tried
training_status: Column('value', Enum(TrainingStatus))
but it doesn't seem to work as I don't understand where the 'value' should be coming from 😓 I would really appreciate any input
Operating System
macOS
Operating System Details
No response
SQLModel Version
0.0.4
Python Version
3.7.9
Additional Context
No response
First Check
Commit to Help
Example Code
Description
I am trying to create an enum column and use the value in the database. But I am getting this error:
Does anyone knows how to help me? I tried
but it doesn't seem to work as I don't understand where the 'value' should be coming from 😓 I would really appreciate any input
Operating System
macOS
Operating System Details
No response
SQLModel Version
0.0.4
Python Version
3.7.9
Additional Context
No response