Skip to content
Discussion options

You must be logged in to vote

Why do you think it doesn't work?
You didn't use explain statement in case of SQLModel query. If you try you will see it works:

from sqlmodel import Field, Index, Session, SQLModel, col, create_engine, select, text

class Foo(SQLModel, table=True):  # type: ignore
    """
    Exposure db version
    """
    __tablename__ = "foo"
    id: int | None = Field(default=None, primary_key=True)
    bar_1: str
    bar_2: str
    bar_3: str

    __table_args__ = (Index("foo_filter_id", "bar_1", "bar_2", "bar_3"),)


engine = create_engine(
    "postgresql://user:mysecretpassword@localhost:5432/some_db", echo=False
)
SQLModel.metadata.create_all(engine)


with Session(engine) as session:
    st = (
…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
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
2 participants