diff --git a/common/templates/config.html b/common/templates/config.html index 511dd607dd..8015fec61b 100755 --- a/common/templates/config.html +++ b/common/templates/config.html @@ -161,6 +161,17 @@
SQL上线
placeholder="自动驳回的等级,1表示警告驳回,2和空表示错误才驳回,其他表示不驳回" /> +
+ +
+ +
+
diff --git a/sql_api/api_workflow.py b/sql_api/api_workflow.py index baf55e7974..0bd13d08c7 100644 --- a/sql_api/api_workflow.py +++ b/sql_api/api_workflow.py @@ -69,6 +69,11 @@ def post(self, request): check_result = check_engine.execute_check( db_name=db_name, sql=request.data["full_sql"].strip() ) + max_sql_length = SysConfig().get("max_sql_length", default_value=10000) + if len(check_result.rows) > int(max_sql_length): + raise serializers.ValidationError( + {"errors": f"执行行数超过{str(max_sql_length)}行,请联系DBA核查!"} + ) except Exception as e: raise serializers.ValidationError({"errors": f"{e}"}) check_result.rows = check_result.to_dict()