Indexes in SQLModel
One column, in the Field:
status_code: int = Field(index=True)
Several columns, in __table_args__, as the core does:
class ActivityEvent(SQLModel, table=True):
__tablename__ = "activity_event"
__table_args__ = (Index("ix_activity_person_time", "person_id", "occurred_at"),)
create_all() builds them, in SQLite and PostgreSQL
- Index your own tables in GP4, never the core's
- Say so in
schema.dbml: indexes { (person_id, occurred_at) }