From 3a09f1d9aafe008e98527a51ea32ccc7dcd479bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BC=9F?= <250213850@qq.com> Date: Tue, 19 Apr 2022 17:16:37 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E6=8B=B7=E8=B4=9D=E6=96=B0?= =?UTF-8?q?=E7=9C=8B=E6=9D=BF=E6=97=B6=EF=BC=8C=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E7=BC=BA=E5=B0=91=E5=AD=97=E6=AE=B5=E8=80=8C=E6=8A=A5=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/api_v1/endpoints/query.py | 5 ++++- api/api_v1/endpoints/xquery.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/api/api_v1/endpoints/query.py b/api/api_v1/endpoints/query.py index f8f6d04..98eec1b 100644 --- a/api/api_v1/endpoints/query.py +++ b/api/api_v1/endpoints/query.py @@ -149,7 +149,10 @@ async def event_model( ) -> schemas.Msg: """ 事件分析""" await analysis.init(data_where=current_user.data_where) - sqls = await analysis.event_model_sql() + try: + sqls = await analysis.event_model_sql() + except Exception as e: + return schemas.Msg(code=-9, msg='报表配置参数异常') res = [] is_hide = [] diff --git a/api/api_v1/endpoints/xquery.py b/api/api_v1/endpoints/xquery.py index fa7c940..44e84f0 100644 --- a/api/api_v1/endpoints/xquery.py +++ b/api/api_v1/endpoints/xquery.py @@ -55,7 +55,10 @@ async def ltv_model_sql( sql = res['sql'] #仅一条筛选条件则是把GM过滤后获取全部数据 if len(analysis.global_filters)==1 and analysis.global_filters[0]['strftv']=='GM': - df = await ckdb.query_dataframe(sql) + try: + df = await ckdb.query_dataframe(sql) + except Exception as e: + return schemas.Msg(code=-9, msg='报表配置参数异常') #多条筛选条件则合成新的sql else: new_sql=""""""