From aded39f68c29e44a50c85be1ddb370d3d1affe9d Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 21 Apr 2020 12:51:13 -0400 Subject: Propose Result as immediate replacement for ResultProxy As progress is made on the _future.Result, including breaking it out such that DBAPI behaviors are local to specific implementations, it becomes apparent that the Result object is a functional superset of ResultProxy and that basic operations like fetchone(), fetchall(), and fetchmany() behave pretty much exactly the same way on the new object. Reorganize things so that ResultProxy is now referred to as LegacyCursorResult, which subclasses CursorResult that represents the DBAPI-cursor version of Result, making use of a multiple inheritance pattern so that the functionality of Result is also available in non-DBAPI contexts, as will be necessary for some ORM patterns. Additionally propose the composition system for Result that will form the basis for ORM-alternative result systems such as horizontal sharding and dogpile cache. As ORM results will soon be coming directly from instances of Result, these extensions will instead build their own ResultFetchStrategies that perform the special steps to create composed or cached result sets. Also considering at the moment not emitting deprecation warnings for fetchXYZ() methods; the immediate issue is Keystone tests are calling upon it, but as the implementations here are proving to be not in any kind of conflict with how Result works, there's not too much issue leaving them around and deprecating at some later point. References: #5087 References: #4395 Fixes: #4959 Change-Id: I8091919d45421e3f53029b8660427f844fee0228 --- lib/sqlalchemy/sql/compiler.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/sqlalchemy/sql/compiler.py') diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 23eff773c..d32e3fd7a 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -702,7 +702,7 @@ class SQLCompiler(Compiled): # relates label names in the final SQL to a tuple of local # column/label name, ColumnElement object (if any) and - # TypeEngine. ResultProxy uses this for type processing and + # TypeEngine. CursorResult uses this for type processing and # column targeting self._result_columns = [] @@ -1056,11 +1056,11 @@ class SQLCompiler(Compiled): return expanded_state - @util.preload_module("sqlalchemy.engine.result") + @util.preload_module("sqlalchemy.engine.cursor") def _create_result_map(self): """utility method used for unit tests only.""" - result = util.preloaded.engine_result - return result.CursorResultMetaData._create_description_match_map( + cursor = util.preloaded.engine_cursor + return cursor.CursorResultMetaData._create_description_match_map( self._result_columns ) -- cgit v1.2.1