MCPcopy Index your code
hub / github.com/dataease/SQLBot / get_last_execute_sql_error

Function get_last_execute_sql_error

backend/apps/chat/curd/chat.py:174–186  ·  view source on GitHub ↗
(session: SessionDep, chart_id: int)

Source from the content-addressed store, hash-verified

172
173
174def get_last_execute_sql_error(session: SessionDep, chart_id: int):
175 stmt = select(ChatRecord.error).where(and_(ChatRecord.chat_id == chart_id)).order_by(
176 ChatRecord.create_time.desc()).limit(1)
177 res = session.execute(stmt).scalar()
178 if res:
179 try:
180 obj = orjson.loads(res)
181 if obj.get('type') and obj.get('type') == 'exec-sql-err':
182 return obj.get('traceback')
183 except Exception:
184 pass
185
186 return None
187
188
189def format_json_data(origin_data: dict):

Callers 1

__init__Method · 0.90

Calls 1

getMethod · 0.65

Tested by

no test coverage detected