Fix sqlalchemy warnings when running tests (#733)

This has been bugging me when running my own tests that call langchain
methods :P
This commit is contained in:
Amos Ng
2023-01-25 22:14:07 +07:00
committed by GitHub
parent bd0bf4e0a9
commit fa6826e417
5 changed files with 6 additions and 7 deletions

View File

@@ -86,7 +86,7 @@ class SQLDatabase:
If the statement returns rows, a string of the results is returned.
If the statement returns no rows, an empty string is returned.
"""
with self._engine.connect() as connection:
with self._engine.begin() as connection:
if self._schema is not None:
connection.exec_driver_sql(f"SET search_path TO {self._schema}")
cursor = connection.exec_driver_sql(command)