diff --git a/README.md b/README.md index 26dccfb..a42fb6b 100644 --- a/README.md +++ b/README.md @@ -353,16 +353,18 @@ def connect(dbapi_connection, connection_record): Enable the extension ```python -session.exec(text('CREATE EXTENSION IF NOT EXISTS vector')) +with engine.begin() as conn: + conn.execute(text("CREATE EXTENSION IF NOT EXISTS vector")) ``` Add a vector column ```python from pgvector.sqlalchemy import VECTOR +from sqlalchemy import Column class Item(SQLModel, table=True): - embedding: list[float] = Field(sa_type=VECTOR(3)) + embedding: list[float] = Field(sa_column=Column(VECTOR(3))) ``` Also supports `HALFVEC`, `BIT`, and `SPARSEVEC`