_extract_error_code operates on wrong exception
dialects.mysql.mysqldb._extract_error_code:
try:
return exception.orig.args[0](0)
except AttributeError:
return None
Exception passed by engine (through _handle_dbapi_exception, and then is_disconnected) is not DBAPIError instance, and therefore the exception does not attribute "orig"
To reproduce: Do any request to make sure that the connection created, and then restart the database and run the query again - because of this error, also method is_disconnected incorrectly returns False for appearing in this case, the exception.
Comments (5)
-
Account Deleted -
repo owner Unfortunately MySQLdb has an inconsistent interface making it impossible for us to cover this line of code, as issuing a
close()
on the underlying connection as we do now causes a different error scenario which is covered. The tests would need to start up a proxy server to the MySQL database and we then yank away the TCP connection (there is a way to do this).Additionally, the failure of the method doesn't cause a noticeable symptom unless one is watching the logs, as it appears that MySQLdb is already doing a reconnect in this situation. If you haven't observed this you should upgrade your MySQLdb. Whether or not the code is wrong, you get back a result for a subsequent execution.
-
repo owner - changed status to open
- removed status
that patch screwed things up since has_table() is sending the SQLA version into the method, also the other dialects also check "orig". fix shortly
-
repo owner - changed status to resolved
-
repo owner - removed milestone
Removing milestone: 0.6.3 (automated comment)
- Log in to comment
My mistake - exception passed right, but mysql.mysqldb dialect's function _extract_error_code proccess it in wrong way.