def _IsRetryable ( error ) : if not isinstance ( error , MySQLdb . OperationalError ) : return False if not error . args : return False code = error . args [ 0 ] return code in _RETRYABLE_ERRORS
python how to check if a database query failed
Returns whether error is likely to be retryable .
def _IsRetryable(error):
  """Returns whether error is likely to be retryable."""
  if not isinstance(error, MySQLdb.OperationalError):
    return False
  if not error.args:
    return False
  code = error.args[0]
  return code in _RETRYABLE_ERRORS