sql >> Base de Datos >  >> RDS >> Mysql

Advertencias de Python y MySQLdb

Así que esta es la forma más fácil que he encontrado... No estoy seguro de por qué no pensé en esto originalmente... pero simplemente suprimí las advertencias emitidas por el cursor:

import warnings
warnings.filterwarnings("ignore", category = MySQLdb.Warning)

Luego agregué este código a mi función importMySql:

mycursor.execute("SHOW WARNINGS")
warnings = mycursor.fetchall()
for i in range(len(warnings)):
    print "Warning - " +warnings[i][2]