111
This commit is contained in:
parent
cd38df987a
commit
17ef776cff
@ -48,7 +48,10 @@ async def check_data(game, data_in: schemas.CheckData):
|
|||||||
try:
|
try:
|
||||||
df = await ck_client.query_dataframe(sql)
|
df = await ck_client.query_dataframe(sql)
|
||||||
report['title'] = df.columns.tolist()
|
report['title'] = df.columns.tolist()
|
||||||
report['data'] = df.values.astype(str).tolist()
|
report['data'] = []
|
||||||
|
for item in df.values:
|
||||||
|
report['data'].append([])
|
||||||
|
report['data'][-1] = [str(i) for i in item]
|
||||||
|
|
||||||
except clickhouse_driver.errors.ServerException as e:
|
except clickhouse_driver.errors.ServerException as e:
|
||||||
if e.code == 47:
|
if e.code == 47:
|
||||||
@ -72,6 +75,8 @@ async def check_data(game, data_in: schemas.CheckData):
|
|||||||
if isinstance(df[k][0], str) and t == 'json':
|
if isinstance(df[k][0], str) and t == 'json':
|
||||||
try:
|
try:
|
||||||
json.loads(df[k][0])
|
json.loads(df[k][0])
|
||||||
|
pass_list.append(f'<p style="color:green;font-size:17px;">通过:字段{k} 是期望的类型</p>')
|
||||||
|
continue
|
||||||
except:
|
except:
|
||||||
fail_list.append(
|
fail_list.append(
|
||||||
f"""<p style="color:red;font-size:17px;">错误:字段{k} 期望{t}类型,不是json格式</p>""")
|
f"""<p style="color:red;font-size:17px;">错误:字段{k} 期望{t}类型,不是json格式</p>""")
|
||||||
|
Loading…
Reference in New Issue
Block a user