pymysql 查询大量数据导致内存使用过高优化方案
import pymysql,random,datetime conn = pymysql.connect(database="wetest", user="bms", password="bms@2018", host="123.156.187.154", port=3306,charset="utf8") cursor = conn.cursor(cursor=pymysql.cursors.SSDictCursor) sql = """ select * from vul_detail """ cursor.execute(sql) while True: row = cursor.fetchone() if not row: break print(row)
I can feel you forgetting me。。 有一种默契叫做我不理你,你就不理我