1.处理sql里面有时间类型无法导出的问题

This commit is contained in:
李伟 2022-10-24 13:52:34 +08:00
parent 9928436a09
commit 8ea85d2512

View File

@ -64,6 +64,10 @@ async def query_sql(
df = await ckdb.query_dataframe(sql)
if df.empty:
return schemas.Msg(code=-9, msg='无数据', data=None)
columns=df.columns.tolist()
for i in columns:
if 'time' in i:
df[i] = df[i].apply(lambda a: pd.to_datetime(a).strftime('%Y-%m-%d %H:%M:%S'))
df_to_stream = DfToStream((df, 'result'))
with df_to_stream as d:
export = d.to_stream()