You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def query_ex(self, query: str, fetch: str = "all",timeout: Optional[int] = None):
"""Execute a SQL command and return the results.
Only for query command.
Args:
query (str): SQL query to run
fetch (str): fetch type
Returns:
List: result list
"""
logger.info(f"Query[{query}]")
if not query:
return [], None
with self.session.connection() as connection:
if timeout is not None:
connection.execution_options(timeout=timeout)
# cursor = self.session.execute(text(query))
cursor = connection.execute(text(query))
if cursor.returns_rows:
if fetch == "all":
result = cursor.fetchall()
elif fetch == "one":
result = cursor.fetchone() # type: ignore
else:
raise ValueError("Fetch parameter must be either 'one' or 'all'")
field_names = list(cursor.keys())
result = list(result)
return field_names, result
return [], None
Are you willing to submit PR?
Yes I am willing to submit a PR!
The text was updated successfully, but these errors were encountered:
Aries-ckt
changed the title
[Bug] [Module Name] Bug title dbgpt.app.openapi.api_v1.editor.api_editor_v1.editor_chart_run 286行报错
[Bug] [Module Name] Bug title dbgpt.app.openapi.api_v1.editor.api_editor_v1.editor_chart_run 286line error
Feb 16, 2025
Search before asking
Operating system information
MacOS(M1, M2...)
Python version information
3.10
DB-GPT version
main
Related scenes
Installation Information
Installation From Source
Docker Installation
Docker Compose Installation
Cluster Installation
AutoDL Image
Other
Device information
Device CPU
Models information
LLM:通义千问
What happened
What you expected to happen
timeout参数未定义错误
How to reproduce
dashboard -> Editor ->run
Additional context
dbgpt.datasource.rdbms.base.RDBMSConnector.query_ex 增加timeout入参,并修改如下
def query_ex(self, query: str, fetch: str = "all",timeout: Optional[int] = None):
"""Execute a SQL command and return the results.
Are you willing to submit PR?
The text was updated successfully, but these errors were encountered: