summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/mysql/mariadbconnector.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-09-13 10:36:16 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2020-09-13 13:06:02 -0400
commit25b8e89d3d425656e51438b5cac7e6e1f2592817 (patch)
tree66d2b0c07245f084ad4058c35c502d51332fd192 /lib/sqlalchemy/dialects/mysql/mariadbconnector.py
parenta4bfde4a18e50d93e44aec5c6216be8a6f9fbacb (diff)
downloadsqlalchemy-25b8e89d3d425656e51438b5cac7e6e1f2592817.tar.gz
Deprecate engine-wise ss cursors; repair mariadbconnector
The server_side_cursors engine-wide feature relies upon regexp parsing of statements a well as general guessing as to when the feature should be used. This is not within the 2.0 way of doing things and should be removed. Additionally, mariadbconnector defaults to unbuffered cursors; add new cursor hooks so that mariadbconnector can specify buffered or unbuffered cursors without too much difficulty. This will also correctly default mariadbconnector to buffered cursors which should repair the segfaults we've been getting. Try to restore the assert_raises that was removed in 5b6dfc0c38bf1f01da4b8 to see if mariadbconnector segfaults are resolved. Change-Id: I77f1c972c742e40694972f578140bb0cac8c39eb
Diffstat (limited to 'lib/sqlalchemy/dialects/mysql/mariadbconnector.py')
-rw-r--r--lib/sqlalchemy/dialects/mysql/mariadbconnector.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/mariadbconnector.py b/lib/sqlalchemy/dialects/mysql/mariadbconnector.py
index aa28ffc67..4e0b4e0a9 100644
--- a/lib/sqlalchemy/dialects/mysql/mariadbconnector.py
+++ b/lib/sqlalchemy/dialects/mysql/mariadbconnector.py
@@ -40,7 +40,11 @@ mariadb_cpy_minimum_version = (1, 0, 1)
class MySQLExecutionContext_mariadbconnector(MySQLExecutionContext):
- pass
+ 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)
class MySQLCompiler_mariadbconnector(MySQLCompiler):
@@ -75,6 +79,8 @@ class MySQLDialect_mariadbconnector(MySQLDialect):
statement_compiler = MySQLCompiler_mariadbconnector
preparer = MySQLIdentifierPreparer_mariadbconnector
+ supports_server_side_cursors = True
+
@util.memoized_property
def _dbapi_version(self):
if self.dbapi and hasattr(self.dbapi, "__version__"):
@@ -89,9 +95,8 @@ class MySQLDialect_mariadbconnector(MySQLDialect):
else:
return (99, 99, 99)
- def __init__(self, server_side_cursors=False, **kwargs):
+ def __init__(self, **kwargs):
super(MySQLDialect_mariadbconnector, self).__init__(**kwargs)
- self.server_side_cursors = True
self.paramstyle = "qmark"
if self.dbapi is not None:
if self._dbapi_version < mariadb_cpy_minimum_version: