summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/mysql/mariadbconnector.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-02-19 14:11:19 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2022-02-19 14:11:19 -0500
commite120837b682a3a822c2dff136ad48b1ca9fb6ce2 (patch)
tree3677b098a8cfac598cab136644308a99dc8f1c50 /lib/sqlalchemy/dialects/mysql/mariadbconnector.py
parentcb35da20d7b93618814a9582a122cc1b24f806b2 (diff)
downloadsqlalchemy-e120837b682a3a822c2dff136ad48b1ca9fb6ce2.tar.gz
updates for mariadb connector 1.0.10
Fixed regression in mariadbconnector dialect as of mariadb connector 1.0.10 where the DBAPI no longer pre-buffers cursor.lastrowid. The dialect now fetches this value proactively for situations where it applies. test_invalidate_on_results seems to pass for mariadbconnector now. the driver has likely changed how it buffers result sets. This is a major change for them to make in a point release so we might want to watch this in case they reverse course again. Fixes: #7738 Change-Id: I9610aae01d1ae42fa92ffbc7123a6948e40ec9dd
Diffstat (limited to 'lib/sqlalchemy/dialects/mysql/mariadbconnector.py')
-rw-r--r--lib/sqlalchemy/dialects/mysql/mariadbconnector.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/mariadbconnector.py b/lib/sqlalchemy/dialects/mysql/mariadbconnector.py
index ea6060c01..fca91204f 100644
--- a/lib/sqlalchemy/dialects/mysql/mariadbconnector.py
+++ b/lib/sqlalchemy/dialects/mysql/mariadbconnector.py
@@ -39,12 +39,21 @@ mariadb_cpy_minimum_version = (1, 0, 1)
class MySQLExecutionContext_mariadbconnector(MySQLExecutionContext):
+ _lastrowid = None
+
def create_server_side_cursor(self):
return self._dbapi_connection.cursor(buffered=False)
def create_default_cursor(self):
return self._dbapi_connection.cursor(buffered=True)
+ def post_exec(self):
+ if self.isinsert and self.compiled.postfetch_lastrowid:
+ self._lastrowid = self.cursor.lastrowid
+
+ def get_lastrowid(self):
+ return self._lastrowid
+
class MySQLCompiler_mariadbconnector(MySQLCompiler):
pass