]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Remove pymysql in asyncmy
authorlong2ice <long2ice@gmail.com>
Fri, 14 Jan 2022 08:50:26 +0000 (03:50 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 14 Jan 2022 17:17:14 +0000 (12:17 -0500)
Removed unnecessary dependency on PyMySQL from the asyncmy dialect. Pull
request courtesy long2ice.

Fixes: #7567
Closes: #7568
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7568
Pull-request-sha: 48cbb3e3c249e431dfd91e88fcb3284af83671e5

Change-Id: Iad5048eaa5de6ad6666b2120df6608fd1bf50e02

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

diff --git a/doc/build/changelog/unreleased_14/7567.rst b/doc/build/changelog/unreleased_14/7567.rst
new file mode 100644 (file)
index 0000000..38fa6f3
--- /dev/null
@@ -0,0 +1,7 @@
+.. change::
+    :tags: bug, mysql
+    :tickets: 7567
+
+    Removed unnecessary dependency on PyMySQL from the asyncmy dialect. Pull
+    request courtesy long2ice.
+
index 02d6b1e9eaeee810155a55960ca0f6fc340e3157..3eb19411e3fa41803b30f23d7f0e21ec15f9583c 100644 (file)
@@ -230,9 +230,8 @@ class AsyncAdaptFallback_asyncmy_connection(AsyncAdapt_asyncmy_connection):
 
 
 class AsyncAdapt_asyncmy_dbapi:
-    def __init__(self, asyncmy, pymysql):
+    def __init__(self, asyncmy):
         self.asyncmy = asyncmy
-        self.pymysql = pymysql
         self.paramstyle = "format"
         self._init_dbapi_attributes()
 
@@ -252,16 +251,6 @@ class AsyncAdapt_asyncmy_dbapi:
         ):
             setattr(self, name, getattr(self.asyncmy.errors, name))
 
-        for name in (
-            "NUMBER",
-            "STRING",
-            "DATETIME",
-            "BINARY",
-            "TIMESTAMP",
-            "Binary",
-        ):
-            setattr(self, name, getattr(self.pymysql, name))
-
     def connect(self, *arg, **kw):
         async_fallback = kw.pop("async_fallback", False)
 
@@ -288,9 +277,7 @@ class MySQLDialect_asyncmy(MySQLDialect_pymysql):
 
     @classmethod
     def dbapi(cls):
-        return AsyncAdapt_asyncmy_dbapi(
-            __import__("asyncmy"), __import__("pymysql")
-        )
+        return AsyncAdapt_asyncmy_dbapi(__import__("asyncmy"))
 
     @classmethod
     def get_pool_class(cls, url):
@@ -319,7 +306,7 @@ class MySQLDialect_asyncmy(MySQLDialect_pymysql):
             )
 
     def _found_rows_client_flag(self):
-        from pymysql.constants import CLIENT
+        from asyncmy.constants import CLIENT
 
         return CLIENT.FOUND_ROWS