Hi everyone, I want to create a new
User
postgresql table that populates a relationship with the table created by PGVectorStore to mark the owner of documents in the vector store. Something like this:
class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True, index=True)
email = Column(String, unique=True, index=True)
hashed_password = Column(String)
files = relationship("File", back_populates="owner")
How can I do that? I'm trying to create a new
sqlalchemy
model but don't know how to make
PGVectorStore
uses this instead of the default model.
class File(Base):
__tablename__ = "data_pg_vector_store"
id = Column(Integer, primary_key=True, index=True)
text = Column(String, index=True)
metadata_ = Column(JSON, index=True)
node_id = Column(String, unique=True, index=True)
embedding = Column(Vector(1024))
owner_id = Column(Integer, ForeignKey("users.id"))
owner = relationship("User", back_populates="files")
Thanks in advance.