From f1d3f29bc48b73168106d670b61c6fe70e11f7e4 Mon Sep 17 00:00:00 2001 From: sujeet Date: Sun, 17 Dec 2023 15:39:44 -0600 Subject: [PATCH] community[patch]: support for Sybase SQL anywhere added. (#14821) - **Description:** support for Sybase SQL anywhere added in sql_database.py file at path langchain\libs\community\langchain_community\utilities - **Issue:** It will resolve default schema setting for Sybase SQL anywhere - **Dependencies:** No, - **Tag maintainer:** @baskaryan, @eyurtsev, @hwchase17, - **Twitter handle:** NA --------- Co-authored-by: learn360sujeet <121271779+learn360sujeet@users.noreply.github.com> Co-authored-by: Bagatur --- libs/community/langchain_community/utilities/sql_database.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/community/langchain_community/utilities/sql_database.py b/libs/community/langchain_community/utilities/sql_database.py index 969d682a54..d573c8c9d9 100644 --- a/libs/community/langchain_community/utilities/sql_database.py +++ b/libs/community/langchain_community/utilities/sql_database.py @@ -405,6 +405,10 @@ class SQLDatabase: connection.exec_driver_sql( f"ALTER SESSION SET CURRENT_SCHEMA = {self._schema}" ) + elif self.dialect == "sqlany": + # If anybody using Sybase SQL anywhere database then it should not + # go to else condition. It should be same as mssql. + pass else: # postgresql and other compatible dialects connection.exec_driver_sql("SET search_path TO %s", (self._schema,)) cursor = connection.execute(text(command))