From b7658059643cd2f8fa58a2132b7d723638445ebc Mon Sep 17 00:00:00 2001 From: Jon Luo <20971593+jzluo@users.noreply.github.com> Date: Tue, 25 Apr 2023 00:10:56 -0400 Subject: [PATCH] Support SQLAlchemy 2.0 (#3310) With https://github.com/executablebooks/jupyter-cache/pull/93 merged and `MyST-NB` updated, we can now support SQLAlchemy 2. Closes #1766 --- langchain/sql_database.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/langchain/sql_database.py b/langchain/sql_database.py index b68b523af..9e86e2031 100644 --- a/langchain/sql_database.py +++ b/langchain/sql_database.py @@ -180,7 +180,7 @@ class SQLDatabase: def _get_sample_rows(self, table: Table) -> str: # build the select command - command = select([table]).limit(self._sample_rows_in_table_info) + command = select(table).limit(self._sample_rows_in_table_info) # save the columns in string format columns_str = "\t".join([col.name for col in table.columns]) diff --git a/pyproject.toml b/pyproject.toml index 985820f6b..0aa9f68c6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ langchain-server = "langchain.server:main" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" pydantic = "^1" -SQLAlchemy = "^1" +SQLAlchemy = ">1.3,<3" requests = "^2" PyYAML = ">=5.4.1" numpy = "^1"