Function
get_last_execute_sql_error
(session: SessionDep, chart_id: int)
Source from the content-addressed store, hash-verified
| 172 | |
| 173 | |
| 174 | def 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 | |
| 189 | def format_json_data(origin_data: dict): |
Tested by
no test coverage detected