From: Mike Bayer Date: Sat, 19 Feb 2022 18:51:22 +0000 (-0500) Subject: remove never-used get_result_cursor_strategy() method X-Git-Tag: rel_2_0_0b1~478 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69e5dfde3ed6cbecae82459a82e0a1fda6228b0e;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git remove never-used get_result_cursor_strategy() method This method I would assume got committed during the 1.4 engine refactor, where we moved from different kinds of ResultProxy implementations to different strategy classes instead. These strategies are set up by dialects by setting "self.cursor_fetch_strategy" in the execution context. The method here was likely a previous iteration of that which got merged but was never used. Change-Id: Iec292428f41c2c245bf7ae78beaa14786c28846c --- diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py index 2aff7d8b6d..8c44c0b2d2 100644 --- a/lib/sqlalchemy/dialects/mssql/base.py +++ b/lib/sqlalchemy/dialects/mssql/base.py @@ -1622,7 +1622,6 @@ class MSExecutionContext(default.DefaultExecutionContext): _select_lastrowid = False _lastrowid = None _rowcount = None - _result_strategy = None def _opt_encode(self, statement): @@ -1749,14 +1748,6 @@ class MSExecutionContext(default.DefaultExecutionContext): except Exception: pass - def get_result_cursor_strategy(self, result): - if self._result_strategy: - return self._result_strategy - else: - return super(MSExecutionContext, self).get_result_cursor_strategy( - result - ) - def fire_sequence(self, seq, type_): return self._execute_scalar( ( diff --git a/lib/sqlalchemy/engine/interfaces.py b/lib/sqlalchemy/engine/interfaces.py index aab6b2de87..860c1faf95 100644 --- a/lib/sqlalchemy/engine/interfaces.py +++ b/lib/sqlalchemy/engine/interfaces.py @@ -2042,10 +2042,6 @@ class ExecutionContext: set. This replaces the practice of setting out parameters within the now-removed ``get_result_proxy()`` method. - .. seealso:: - - :meth:`.ExecutionContext.get_result_cursor_strategy` - """ raise NotImplementedError() @@ -2059,69 +2055,6 @@ class ExecutionContext: raise NotImplementedError() - def get_result_cursor_strategy(self, result): - """Return a result cursor strategy for a given result object. - - This method is implemented by the :class:`.DefaultDialect` and is - only needed by implementing dialects in the case where some special - steps regarding the cursor must be taken, such as manufacturing - fake results from some other element of the cursor, or pre-buffering - the cursor's results. - - A simplified version of the default implementation is:: - - from sqlalchemy.engine.result import DefaultCursorFetchStrategy - - class MyExecutionContext(DefaultExecutionContext): - def get_result_cursor_strategy(self, result): - return DefaultCursorFetchStrategy.create(result) - - Above, the :class:`.DefaultCursorFetchStrategy` will be applied - to the result object. For results that are pre-buffered from a - cursor that might be closed, an implementation might be:: - - - from sqlalchemy.engine.result import ( - FullyBufferedCursorFetchStrategy - ) - - class MyExecutionContext(DefaultExecutionContext): - _pre_buffered_result = None - - def pre_exec(self): - if self.special_condition_prebuffer_cursor(): - self._pre_buffered_result = ( - self.cursor.description, - self.cursor.fetchall() - ) - - def get_result_cursor_strategy(self, result): - if self._pre_buffered_result: - description, cursor_buffer = self._pre_buffered_result - return ( - FullyBufferedCursorFetchStrategy. - create_from_buffer( - result, description, cursor_buffer - ) - ) - else: - return DefaultCursorFetchStrategy.create(result) - - This method replaces the previous not-quite-documented - ``get_result_proxy()`` method. - - .. versionadded:: 1.4 - result objects now interpret cursor results - based on a pluggable "strategy" object, which is delivered - by the :class:`.ExecutionContext` via the - :meth:`.ExecutionContext.get_result_cursor_strategy` method. - - .. seealso:: - - :meth:`.ExecutionContext.get_out_parameter_values` - - """ - raise NotImplementedError() - def handle_dbapi_exception(self, e): """Receive a DBAPI exception which occurred upon execute, result fetch, etc."""