cherrypy - sqlalchemy pymssql "connection reset by peer" recovery -


i'm running cherrypy webservice , wondering best option recover "connection reset peer" pymssql connection via sqlalchemy. right have restart webservice.

this seems bug in is_disconnect() method pymssql ignore tcp connection , timeout failures, leaving cursor in unhappy state; see http://www.sqlalchemy.org/trac/ticket/2172. now, can monkey-patch as:

from sqlalchemy.dialects.mssql import pymssql  def is_disconnect(self, e):     msg in (         "20003",         "20004",         "error 10054",         "not connected ms sql server",         "connection closed"         ):         if msg in str(e):             return true     else:         return false  pymssql.msdialect_pymssql.is_disconnect = is_disconnect 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -