Do not use MYSQL_OPT_RECONNECT as possible. (#664)

MySQL 8.0.33+ shows deprecation warning to stderr.
So we avoid using it as possible.

In the future, we will deprecate `reconnect` option of the
`Connection.ping()`.
This commit is contained in:
Inada Naoki
2023-11-13 17:36:09 +09:00
committed by GitHub
parent 91c04282ea
commit 0d0fff7662
2 changed files with 28 additions and 16 deletions

View File

@ -192,7 +192,9 @@ class Connection(_mysql.connection):
super().__init__(*args, **kwargs2)
self.cursorclass = cursorclass
self.encoders = {k: v for k, v in conv.items() if type(k) is not int}
self.encoders = {
k: v for k, v in conv.items() if type(k) is not int # noqa: E721
}
self._server_version = tuple(
[numeric_part(n) for n in self.get_server_info().split(".")[:2]]