Skip to content

The agent engineering platform.

community[patch]: Don't set search path for unknown SQL dialects (#16047)

Mohammad Mohtashim1fa056c324cc
diff --git a/libs/community/langchain_community/utilities/sql_database.py b/libs/community/langchain_community/utilities/sql_database.py
index 9f665b7132..8379fbc337 100644
--- a/libs/community/langchain_community/utilities/sql_database.py
+++ b/libs/community/langchain_community/utilities/sql_database.py
@@ -409,8 +409,9 @@ class SQLDatabase:
# 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
+ elif self.dialect == "postgresql": # postgresql
connection.exec_driver_sql("SET search_path TO %s", (self._schema,))
+
cursor = connection.execute(text(command))
if cursor.returns_rows:
if fetch == "all":