Skip to content
Discussion options

You must be logged in to vote

Validation is not triggered when table=True by choice. See #52 for alternatives. I would suggest you to use a non table class with the validation and then inherit it from your table=True.
Like so:

class MarketBase(SQLModel):
    id: int | None = Field(default=None, primary_key=True)
    question: str
    description: str
    outcomes: list[str] = Field(
        default_factory=list, description="list of possible outcomes"
    )
    outcomePrices: list[float] = Field(
        default_factory=list, description="probabilities of each outcome"
    )
    volume: float
    categories: list[str] = Field(
        default_factory=list, description="list of categories"
    )

    @field_validator("…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@joachimhuet
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