diff --git a/api/api_v1/endpoints/query.py b/api/api_v1/endpoints/query.py index f1fb988..da48b11 100644 --- a/api/api_v1/endpoints/query.py +++ b/api/api_v1/endpoints/query.py @@ -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()