Skip to content

How to reference field in __table_args__ #1411

Answered by yihuang
yihuang asked this question in Questions
Discussion options

You must be logged in to vote
class TOrder(SQLModel, table=True):
  user: str
  is_common: bool = Field(sa_column=Boolean)

  __table_args__ = (
    Index('ix_user_common', 'user', postgresql_where=(is_common.sa_column.is_(True)))
  )

this works

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by yihuang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
1 participant