This commit is contained in:
wuaho 2021-09-23 12:04:11 +08:00
parent fe0c72c8ad
commit e81f6d4173
2 changed files with 3 additions and 3 deletions

View File

@ -23,10 +23,9 @@ async def check_data(db, game, data_in: schemas.CheckData):
is_unique = data_in.is_unique
props = data_in.props
where = data_in.where
report = []
limit = 10
check_type = copy.deepcopy(props)
check_type.update(settings.DEFAULT_FIELD)
check_type.update(data_in.default_field)
select = ','.join([f'`{field}`' for field in check_type.keys()])
sql = f"""select {select} from {db}.event where game='{game}' and `#event_name`='{event_name}'"""
@ -65,7 +64,7 @@ async def check_data(db, game, data_in: schemas.CheckData):
for k, t in check_type.items():
if not isinstance(df[k][0], getattr(type_map, t)):
fail_list.append(f'<p style="color:red;font-size:17px;">错误:字段{k} 期望{t}类型,得到{type(df[k][0])}</p>')
fail_list.append(f"""<p style="color:red;font-size:17px;">错误:字段{k} 期望{t}类型,得到->{re.findall("'(.*)'>",str(type(df[k][0])))[0]}</p>""")
else:
pass_list.append(f'<p style="color:green;font-size:17px;">通过:字段{k} 是期望的类型</p>')

View File

@ -5,6 +5,7 @@ class CheckData(BaseModel):
event_name: str
is_unique: bool
props: dict
default_field: dict = dict()
where: dict = dict()