Migrated issue, originally created by Mike Lundy (@novas0x2a)
In 0.9.7 (and going back to at least 0.7, I think) mysql/base's is_disconnect catches OperationalError and, if the error is on the whitelist, reports it as a disconnect. One of the items on the list, error 2014 (COMMANDS_OUT_OF_SYNC), is actually a ProgrammingError, not an OperationalError (See mysqldb source and constants list).
One potential easy fix is attached.
Attachments: 0001-error-2014-is-a-ProgrammingError.patch