diff --git a/sql/db_diagnostic.py b/sql/db_diagnostic.py index 89bb10bce0..ca01b0bc96 100644 --- a/sql/db_diagnostic.py +++ b/sql/db_diagnostic.py @@ -162,7 +162,7 @@ def tablespace(request): if not query_result.error: table_space = query_result.to_dict() r = query_engine.tablespace_count() - total = r[0][0] + total = r.rows[0][0] result = {"status": 0, "msg": "ok", "rows": table_space, "total": total} else: result = {"status": 1, "msg": query_result.error} diff --git a/sql/slowlog.py b/sql/slowlog.py index ca952951ad..4211bb1528 100644 --- a/sql/slowlog.py +++ b/sql/slowlog.py @@ -28,8 +28,8 @@ def slowquery_review(request): start_time = request.POST.get("StartTime") end_time = request.POST.get("EndTime") db_name = request.POST.get("db_name") - limit = request.POST.get("limit") - offset = request.POST.get("offset") + limit = int(request.POST.get("limit")) + offset = int(request.POST.get("offset")) # 服务端权限校验 try: user_instances(request.user, db_type=["mysql"]).get(instance_name=instance_name) @@ -118,8 +118,8 @@ def slowquery_review_history(request): end_time = request.POST.get("EndTime") db_name = request.POST.get("db_name") sql_id = request.POST.get("SQLId") - limit = request.POST.get("limit") - offset = request.POST.get("offset") + limit = int(request.POST.get("limit")) + offset = int(request.POST.get("offset")) # 服务端权限校验 try: user_instances(request.user, db_type=["mysql"]).get(instance_name=instance_name)