Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
1.4 kB
1
Indexable
Never
from sys import exc_info as sys_exc_info
from json import loads as json_loads
import json

log = {'Exception': '(pymysql.err.OperationalError) (2006, \'MySQL server has gone away (ConnectionResetError(104, \'Connection reset by peer\'))\')\n[SQL: SELECT id AS subtype_outcome_map_nbr FROM ***.tcare_intr_stype_otcm_map_seq]\n(Background on this error at: https://sqlalche.me/e/14/e3q8) . Line No - 203 '}
l = json_loads(str(log).replace("'", '"'))
for i in l:
    i['log'] = json_loads(i['log'])

print(l)

try:
    log_event_result = {'failedTables': {'tcare_intr_subtype_outcome_map': {'Error': 'pyJobException', 'Exception': '(pymysql.err.OperationalError) (2006, "MySQL server has gone away (ConnectionResetError(104, \'Connection reset by peer\'))")\n[SQL: SELECT id AS subtype_outcome_map_nbr FROM ***.tcare_intr_stype_otcm_map_seq]\n(Background on this error at: https://sqlalche.me/e/14/e3q8) . Line No - 203 '}}, 'successTables': {'tcare_ui_composite_element_map': 'Success', 'tcare_interaction_sub_type_ref': 'Success', 'tcare_interaction_outcome_ref': 'Success', 'tcare_interaction_category_ref': 'Success', 'tcare_care_search_reference': 'Success', 'tcare_activity_rulegroup_map': 'Success', 'tcare_acct_srvc_category_ref': 'Success'}}
    print(json_loads(json.dumps(log_event_result)))
except Exception as __exp:
    print("{} . Line No - {}".format(str(__exp), str(sys_exc_info()[-1].tb_lineno)))
Leave a Comment