Skip to content

Commit

Permalink
解决escape_string在MySQLdb高版本不支持问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Grain-Yu committed Nov 9, 2023
1 parent 3ade918 commit 43fe47e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Django==3.2.19
mysqlclient==2.0.3
mysqlclient==2.*
requests==2.31.0
simplejson==3.17.2
mybatis_mapper2sql==0.1.9
Expand Down
3 changes: 2 additions & 1 deletion sql/slowlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from pyecharts.charts import Line
from pyecharts import options as opts
from common.utils.chart_dao import ChartDao
from import pymysql import escape_string

from sql.utils.resource_group import user_instances
from common.utils.extend_json_encoder import ExtendJSONEncoder
Expand Down Expand Up @@ -206,7 +207,7 @@ def slowquery_review_history(request):
def report(request):
"""返回慢SQL历史趋势"""
checksum = request.GET.get("checksum")
checksum = MySQLdb.escape_string(checksum).decode("utf-8")
checksum = pymysql.escape_string(checksum).decode("utf-8")
cnt_data = ChartDao().slow_query_review_history_by_cnt(checksum)
pct_data = ChartDao().slow_query_review_history_by_pct_95_time(checksum)
cnt_x_data = [row[1] for row in cnt_data["rows"]]
Expand Down

0 comments on commit 43fe47e

Please sign in to comment.