weixin_39980129的博客但如果我们想分析所有SQL查询的分布,即哪类SQL查询次数最多的时候,我们可以开启general log来统计。开启general logmysql> show variables like '%general%';+------------------+------...
weixin_39840729的博客/usr/bin/env python#-*- coding: utf-8 -*-"""Create on ''Update on ''Author:guangxu.qi"""importsysreload(sys)sys.setdefaultencoding('utf-8')sys.path.append("/data/dp/dp_common/common/dbase")from myDb.....
sql = "SELECT type_code, count(1) as num FROM test GROUP BY type_code ORDER BY num desc" cur.execute(sql) ``` 执行`execute()`后,使用`fetchall()`方法获取所有结果: ```python res = cur.fetchall() ```...