Skip to content

Commit

Permalink
Merge pull request #22 from hoffmann/patch-1
Browse files Browse the repository at this point in the history
Mark connections in pool as closed to prevent reuse
  • Loading branch information
Jan authored and Jan committed Oct 17, 2014
2 parents 61c3a0c + 4c0d720 commit caa4ecf
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sqlalchemy_exasol/pyodbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,15 @@ def create_connect_args(self, url):
connectors.extend(['%s=%s' % (k, v) for k, v in six.iteritems(keys)])
return [[";".join(connectors)], connect_args]

def is_disconnect(self, e, connection, cursor):
if isinstance(e, self.dbapi.Error):
error_codes = [
'40004', # Connection lost.
'40009', # Connection lost after internal server error.
'40018', # Connection lost after system running out of memory.
'40020', # Connection lost after system running out of memory.
]
return e.args[0] in error_codes
return super(EXADialect_pyodbc, self).is_disconnect(e, connection, cursor)

dialect = EXADialect_pyodbc

0 comments on commit caa4ecf

Please sign in to comment.