mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-07 13:40:46 +00:00
Ensure compatibility with both SQLAlchemy v1/v2 fix the issue when using SQLAlchemy v1 (reported at #3884) ` langchain/vectorstores/pgvector.py", line 168, in create_tables_if_not_exists self._conn.commit() AttributeError: 'Connection' object has no attribute 'commit' ` Ref Doc : https://docs.sqlalchemy.org/en/14/changelog/migration_20.html#migration-20-autocommit
This commit is contained in:
parent
ba0057c077
commit
deffc65693
@ -164,12 +164,12 @@ class PGVector(VectorStore):
|
||||
self.logger.exception(e)
|
||||
|
||||
def create_tables_if_not_exists(self) -> None:
|
||||
with self._conn.begin():
|
||||
Base.metadata.create_all(self._conn)
|
||||
self._conn.commit()
|
||||
|
||||
def drop_tables(self) -> None:
|
||||
with self._conn.begin():
|
||||
Base.metadata.drop_all(self._conn)
|
||||
self._conn.commit()
|
||||
|
||||
def create_collection(self) -> None:
|
||||
if self.pre_delete_collection:
|
||||
|
Loading…
Reference in New Issue
Block a user