From d32d7bc2f0d1d6463096ae85a5b2734a05f7264d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=B0=E5=98=89=E8=BD=A9?= <52522047+lanheader@users.noreply.github.com> Date: Mon, 6 Nov 2023 17:23:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Esql=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E8=A1=8C=E6=95=B0=E9=99=90=E5=88=B6=20(#2366)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 新增cas登录 * 新增cas登录 * 新增cas登录 * 新增cas登录 * 新增cas登录 * black格式化 * 修改模块引用错误 * 修改模块引用错误 * 修改模块引用错误 * 新增最大SQL提交数 * Update mssql.py 格式化代码 * black 代码 --------- Co-authored-by: lanjiaxuan --- common/templates/config.html | 11 +++++++++++ sql_api/api_workflow.py | 5 +++++ 2 files changed, 16 insertions(+) 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()