Mysql
 SQL >> Database >  >> RDS >> Mysql

Timeout MySQL in Python

Se la connessione cade, prova il ping e riconnetti.

try:
    self.connection.ping(True)
except MySQLdb.OperationalError:
    self.connection = MySQLdb.connect(...)
    self.cursor = self.connection.cursor(MySQLdb.cursors.DictCursor)