Skip to content

Commit

Permalink
datajoint/connection.py: fix datajoint#896
Browse files Browse the repository at this point in the history
  • Loading branch information
ixcat committed Mar 26, 2021
1 parent 909749a commit f41f5cc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions datajoint/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,10 @@ def query(self, query, args=(), *, as_dict=False, suppress_warnings=True, reconn
raise
warnings.warn("MySQL server has gone away. Reconnecting to the server.")
connect_host_hook(self)
if self.is_connected:
logger.info("Connected {user}@{host}:{port}".format(**self.conn_info))
self.connection_id = self.query('SELECT connection_id()').fetchone()[0]

if self._in_transaction:
self.cancel_transaction()
raise errors.LostConnectionError("Connection was lost during a transaction.")
Expand Down

0 comments on commit f41f5cc

Please sign in to comment.