fix: pgvector hang risk if table not exist #3883 (#3884)

This commit is contained in:
玄猫 2023-05-02 11:57:31 +08:00 committed by GitHub
parent 9acf80fd69
commit 188a7bd653
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -165,9 +165,11 @@ class PGVector(VectorStore):
def create_tables_if_not_exists(self) -> None: def create_tables_if_not_exists(self) -> None:
Base.metadata.create_all(self._conn) Base.metadata.create_all(self._conn)
self._conn.commit()
def drop_tables(self) -> None: def drop_tables(self) -> None:
Base.metadata.drop_all(self._conn) Base.metadata.drop_all(self._conn)
self._conn.commit()
def create_collection(self) -> None: def create_collection(self) -> None:
if self.pre_delete_collection: if self.pre_delete_collection: