mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-25 08:03:39 +00:00
community[patch]: Don't set search path for unknown SQL dialects (#16047)
- **Description:** Made a small fix for the `SQLDatabase` highlighted in an issue. The issue pertains to switching schema for different SQL engines. - **Issue:** #16023 @baskaryan
This commit is contained in:
parent
11327e6b64
commit
1fa056c324
@ -409,8 +409,9 @@ class SQLDatabase:
|
|||||||
# If anybody using Sybase SQL anywhere database then it should not
|
# If anybody using Sybase SQL anywhere database then it should not
|
||||||
# go to else condition. It should be same as mssql.
|
# go to else condition. It should be same as mssql.
|
||||||
pass
|
pass
|
||||||
else: # postgresql and other compatible dialects
|
elif self.dialect == "postgresql": # postgresql
|
||||||
connection.exec_driver_sql("SET search_path TO %s", (self._schema,))
|
connection.exec_driver_sql("SET search_path TO %s", (self._schema,))
|
||||||
|
|
||||||
cursor = connection.execute(text(command))
|
cursor = connection.execute(text(command))
|
||||||
if cursor.returns_rows:
|
if cursor.returns_rows:
|
||||||
if fetch == "all":
|
if fetch == "all":
|
||||||
|
Loading…
Reference in New Issue
Block a user