Skip to content

Commit 45b054c

Browse files
committed
Updated example [skip ci]
1 parent efa1442 commit 45b054c

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

examples/implicit/example.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from implicit.datasets.movielens import get_movielens
33
from pgvector.sqlalchemy import VECTOR
44
from sqlalchemy import create_engine, insert, select, text, Integer, String
5-
from sqlalchemy.orm import mapped_column, DeclarativeBase, Session
5+
from sqlalchemy.orm import mapped_column, DeclarativeBase, Mapped, Session
66

77
engine = create_engine('postgresql+psycopg://localhost/pgvector_example')
88
with engine.connect() as conn:
@@ -17,16 +17,16 @@ class Base(DeclarativeBase):
1717
class User(Base):
1818
__tablename__ = 'user'
1919

20-
id = mapped_column(Integer, primary_key=True)
21-
factors = mapped_column(VECTOR(20))
20+
id: Mapped[int] = mapped_column(Integer, primary_key=True)
21+
factors: Mapped[list[float]] = mapped_column(VECTOR(20))
2222

2323

2424
class Item(Base):
2525
__tablename__ = 'item'
2626

27-
id = mapped_column(Integer, primary_key=True)
28-
title = mapped_column(String)
29-
factors = mapped_column(VECTOR(20))
27+
id: Mapped[int] = mapped_column(Integer, primary_key=True)
28+
title: Mapped[str] = mapped_column(String)
29+
factors: Mapped[list[float]] = mapped_column(VECTOR(20))
3030

3131

3232
Base.metadata.drop_all(engine)

0 commit comments

Comments
 (0)