From 5ba0aee97b7ba75ace8eec534df2a0a5f250723f Mon Sep 17 00:00:00 2001 From: learn360sujeet <121271779+learn360sujeet@users.noreply.github.com> Date: Sun, 17 Dec 2023 12:21:38 -0600 Subject: [PATCH 1/2] support for sybase sql anywhere added --- libs/community/langchain_community/utilities/sql_database.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/community/langchain_community/utilities/sql_database.py b/libs/community/langchain_community/utilities/sql_database.py index 969d682a5410e..0c331d56b3886 100644 --- a/libs/community/langchain_community/utilities/sql_database.py +++ b/libs/community/langchain_community/utilities/sql_database.py @@ -405,6 +405,9 @@ def _execute( 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)) From 97a88e698187567b09e3529b275d40228f36ef94 Mon Sep 17 00:00:00 2001 From: Bagatur Date: Sun, 17 Dec 2023 16:31:23 -0500 Subject: [PATCH 2/2] lint --- libs/community/langchain_community/utilities/sql_database.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/community/langchain_community/utilities/sql_database.py b/libs/community/langchain_community/utilities/sql_database.py index 0c331d56b3886..d573c8c9d983e 100644 --- a/libs/community/langchain_community/utilities/sql_database.py +++ b/libs/community/langchain_community/utilities/sql_database.py @@ -406,7 +406,8 @@ def _execute( 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. + # 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,))