summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/mysql/asyncmy.py
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2021-09-18 14:55:49 +0000
committerGerrit Code Review <gerrit@ci3.zzzcomputing.com>2021-09-18 14:55:49 +0000
commit4d9bc42f52e2c37e4285cce0a41bfd9b030834b7 (patch)
treeaf8a7ba9e14cc20c6c8ffc3ca1f04a47ab6d41e1 /lib/sqlalchemy/dialects/mysql/asyncmy.py
parent955e6bd558e15fa1b0cde9a944d6f53d202d91c2 (diff)
parentc4006ddd20e60a0139ec1c87830f0bd1125a7fef (diff)
downloadsqlalchemy-4d9bc42f52e2c37e4285cce0a41bfd9b030834b7.tar.gz
Merge "pin asyncmy>=0.2.0 and remove cursor close workarounds"
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 fb96cd686..0fca338f5 100644
--- a/lib/sqlalchemy/dialects/mysql/asyncmy.py
+++ b/lib/sqlalchemy/dialects/mysql/asyncmy.py
@@ -151,8 +151,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
)
@@ -160,13 +158,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())
@@ -180,13 +174,12 @@ class AsyncAdapt_asyncmy_ss_cursor(AsyncAdapt_asyncmy_cursor):
class AsyncAdapt_asyncmy_connection(AdaptedConnection):
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):
@@ -218,20 +211,13 @@ class AsyncAdapt_asyncmy_connection(AdaptedConnection):
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()