在AWS log日志中得到了這樣的錯誤信息:
部分省略
@message
{"time": "2022-07-22T03:23:20+00:00", "level": "error", "app_log_type": "failure", "name": "python-batch-data-anonymization", "trace": {"class": null, "file": "/program/app/table_config.py", "line": 174, "message": "Wrong name in config or last date log.", "errors": {"Errr2_1": [{"Sheet": "Index", "Table": "provider_ind_sms_settings"}, {"Sheet": "Index", "Table": "provider_ind_sms_templates"}], "Errr2_2": [], "Errr2_3": [], "Errr2_4": [], "Errr2_5": [], "Errr2_6": []}}, "log_id": "4e2807a5-ab0c-400e-b822-ac41855f1caa", "log_no": "Errr2_11"}
table_config.py文件第174行前後如下:
def validate_dataframe(self):
for sheetname in self.df_conf.keys(): if sheetname == "Index": try: if not self.df_conf[sheetname].dtypes[2] == "int64": raise TypeError(self.ERR_CONFIG_OUTPUT) except TypeError as e: err = {
"Sheet": "Index", "Column": "OUTPUT"} self.errors[self.ERR_CONFIG_OUTPUT].append(err) self.log.error(e, e.args[0], None, err) elif sheetname.startswith(self.SHEET_PREFIX): try: if not self.df_conf[sheetname].dtypes[1] == "bool": raise TypeError(self.ERR_CONFIG_OUTPUT) except TypeError as e: err = {
"Sheet": sheetname, "Column": "OUTPUT"} self.errors[self.ERR_CONFIG_OUTPUT].append(err) self.log.error(e, e.args[0], None, err) try: if not self.df_conf[sheetname].dtypes[2] == "bool": raise TypeError(self.ERR_CONFIG_HASHED) except TypeError as e: err = {
"Sheet": sheetname, "Column": "HASHED"} self.errors[self.ERR_CONFIG_HASHED].append(err) self.log.error(e, e.args[0], None, err)想請教此錯誤最可能是因何(找不到表名?以外的問題?)而起的,若代碼有不足之處再補充,感謝指導!