summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/mysql/asyncmy.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-09-18 09:47:34 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2021-09-18 09:47:34 -0400
commitc4006ddd20e60a0139ec1c87830f0bd1125a7fef (patch)
tree0eb5dfc3e164ce11a4ae542e99a790b8c60e6669 /lib/sqlalchemy/dialects/mysql/asyncmy.py
parentc50183274728544e40e7da4fd35cf240da5df656 (diff)
downloadsqlalchemy-c4006ddd20e60a0139ec1c87830f0bd1125a7fef.tar.gz
pin asyncmy>=0.2.0 and remove cursor close workarounds
Change-Id: I9426e09e4fd21f9c94f3c89b199a7784d33b949f
Diffstat (limited to 'lib/sqlalchemy/dialects/mysql/asyncmy.py')
-rw-r--r--lib/sqlalchemy/dialects/mysql/asyncmy.py22
1 files changed, 4 insertions, 18 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/asyncmy.py b/lib/sqlalchemy/dialects/mysql/asyncmy.py
index cde43398d..badf6e389 100644
--- a/lib/sqlalchemy/dialects/mysql/asyncmy.py
+++ b/lib/sqlalchemy/dialects/mysql/asyncmy.py
@@ -150,8 +150,6 @@ class AsyncAdapt_asyncmy_ss_cursor(AsyncAdapt_asyncmy_cursor):
self._connection = adapt_connection._connection
self.await_ = adapt_connection.await_
- adapt_connection._ss_cursors.add(self)
-
cursor = self._connection.cursor(
adapt_connection.dbapi.asyncmy.cursors.SSCursor
)
@@ -159,13 +157,9 @@ class AsyncAdapt_asyncmy_ss_cursor(AsyncAdapt_asyncmy_cursor):
self._cursor = self.await_(cursor.__aenter__())
def close(self):
- try:
- if self._cursor is not None:
- self.await_(self._cursor.fetchall())
- self.await_(self._cursor.close())
- self._cursor = None
- finally:
- self._adapt_connection._ss_cursors.discard(self)
+ if self._cursor is not None:
+ self.await_(self._cursor.close())
+ self._cursor = None
def fetchone(self):
return self.await_(self._cursor.fetchone())
@@ -179,13 +173,12 @@ class AsyncAdapt_asyncmy_ss_cursor(AsyncAdapt_asyncmy_cursor):
class AsyncAdapt_asyncmy_connection:
await_ = staticmethod(await_only)
- __slots__ = ("dbapi", "_connection", "_execute_mutex", "_ss_cursors")
+ __slots__ = ("dbapi", "_connection", "_execute_mutex")
def __init__(self, dbapi, connection):
self.dbapi = dbapi
self._connection = connection
self._execute_mutex = asyncio.Lock()
- self._ss_cursors = set()
@asynccontextmanager
async def _mutex_and_adapt_errors(self):
@@ -217,20 +210,13 @@ class AsyncAdapt_asyncmy_connection:
else:
return AsyncAdapt_asyncmy_cursor(self)
- def _shutdown_ss_cursors(self):
- for curs in list(self._ss_cursors):
- curs.close()
-
def rollback(self):
- self._shutdown_ss_cursors()
self.await_(self._connection.rollback())
def commit(self):
- self._shutdown_ss_cursors()
self.await_(self._connection.commit())
def close(self):
- self._shutdown_ss_cursors()
# it's not awaitable.
self._connection.close()