diff --git a/api/api_v1/endpoints/query.py b/api/api_v1/endpoints/query.py index 98eec1b..d4f461d 100644 --- a/api/api_v1/endpoints/query.py +++ b/api/api_v1/endpoints/query.py @@ -369,7 +369,10 @@ async def retention_model(request: Request, current_user: schemas.UserDB = Depends(deps.get_current_user) ) -> schemas.Msg: await analysis.init(data_where=current_user.data_where) - res = await analysis.retention_model_sql2() #初始化开始时间结束时间,sql语句 字典 + try: + res = await analysis.retention_model_sql2() #初始化开始时间结束时间,sql语句 字典 + except Exception as e: + return schemas.Msg(code=-9, msg='报表配置参数异常') sql = res['sql'] #获取到sql语句 df = await ckdb.query_dataframe(sql) if df.empty: @@ -965,7 +968,10 @@ async def scatter_model( """分布分析 模型""" await analysis.init(data_where=current_user.data_where) event_type = analysis.events[0]['eventName'] - res = await analysis.scatter_model_sql() + try: + res = await analysis.scatter_model_sql() + except Exception as e: + return schemas.Msg(code=-9, msg='报表配置参数异常') end_date=analysis.end_date start_date=analysis.start_date where=analysis.events[-1]['quotaname']