]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
bypass pyodbc default server version / set charset
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 3 May 2022 12:58:27 +0000 (08:58 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 3 May 2022 13:00:00 +0000 (09:00 -0400)
Further adjustments to the MySQL PyODBC dialect to allow for complete
connectivity, which was previously still not working despite fixes in
:ticket:`7871`.

Fixes: #7966
Change-Id: I549ea9e7b6e722e22d3e25bdb2fe0934603e2454

doc/build/changelog/unreleased_14/7966.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mysql/pyodbc.py

diff --git a/doc/build/changelog/unreleased_14/7966.rst b/doc/build/changelog/unreleased_14/7966.rst
new file mode 100644 (file)
index 0000000..b07baec
--- /dev/null
@@ -0,0 +1,7 @@
+.. change::
+    :tags: bug, mysql
+    :tickets: 7966
+
+    Further adjustments to the MySQL PyODBC dialect to allow for complete
+    connectivity, which was previously still not working despite fixes in
+    :ticket:`7871`.
index 28dafc5a01efae95d9c348bd9e05319a93a35252..2d31dfe5fb0c7ed4315189be478e77d5328a4cab 100644 (file)
@@ -90,6 +90,9 @@ class MySQLDialect_pyodbc(PyODBCConnector, MySQLDialect):
         #
         # If it's decided that issuing that sort of SQL leaves you SOL, then
         # this can prefer the driver value.
+
+        # set this to None as _fetch_setting attempts to use it (None is OK)
+        self._connection_charset = None
         try:
             value = self._fetch_setting(connection, "character_set_client")
             if value:
@@ -103,6 +106,9 @@ class MySQLDialect_pyodbc(PyODBCConnector, MySQLDialect):
         )
         return "latin1"
 
+    def _get_server_version_info(self, connection):
+        return MySQLDialect._get_server_version_info(self, connection)
+
     def _extract_error_code(self, exception):
         m = re.compile(r"\((\d+)\)").search(str(exception.args))
         c = m.group(1)