소스 검색

Add template DB Assistant and exesql sql column description (#2054)

### What problem does this PR solve?

### Type of change

- [x] New Feature (non-breaking change which adds functionality)

---------

Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
tags/v0.10.0
H 1 년 전
부모
커밋
21f2c5838b
No account linked to committer's email address
2개의 변경된 파일684개의 추가작업 그리고 3개의 파일을 삭제
  1. 3
    3
      agent/component/exesql.py
  2. 681
    0
      agent/templates/DB Assistant.json

+ 3
- 3
agent/component/exesql.py 파일 보기

@@ -82,9 +82,9 @@ class ExeSQL(ComponentBase, ABC):
continue
try:
query = db.execute_sql(single_sql)
sql_res.append(
{"content": "\n##Total: " + str(query.rowcount) + "\n" + pd.DataFrame(
[i for i in query.fetchmany(size=self._param.top_n)]).to_markdown()})
single_res = pd.DataFrame([i for i in query.fetchmany(size=self._param.top_n)])
single_res.columns = [i[0] for i in query.description]
sql_res.append({"content": "\nTotal: " + str(query.rowcount) + "\n" + single_res.to_markdown()})
except Exception as e:
sql_res.append({"content": "**Error**:" + str(e) + "\nError SQL Statement:" + single_sql})
pass

+ 681
- 0
agent/templates/DB Assistant.json
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


Loading…
취소
저장