diff --git a/singlestoredb/mysql/connection.py b/singlestoredb/mysql/connection.py index 4e7279f5..ec32c0ab 100644 --- a/singlestoredb/mysql/connection.py +++ b/singlestoredb/mysql/connection.py @@ -916,7 +916,8 @@ def _sync_connection(self): raise err.InterfaceError(0, 'Connection URL has not been established') # If it's just a password change, we don't need to reconnect - if (self.host, self.port, self.user, self.db) == \ + if self._sock is not None and \ + (self.host, self.port, self.user, self.db) == \ (out['host'], out['port'], out['user'], out.get('database')): return @@ -1167,7 +1168,7 @@ def _execute_command(self, command, sql): """ self._sync_connection() - if not self._sock: + if self._sock is None: raise err.InterfaceError(0, 'The connection has been closed') # If the last query was unbuffered, make sure it finishes before