summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/loading.py
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2021-06-08 18:00:44 +0000
committerGerrit Code Review <gerrit@ci3.zzzcomputing.com>2021-06-08 18:00:44 +0000
commit5a0c700bb96bf2d80cfbf03f5ddfa97964987e4e (patch)
tree5cf4357c26a52b2daae24168adb2225dbe14cd81 /lib/sqlalchemy/orm/loading.py
parent14a4849e14a4f94dfcb5cef3600d439b7c716344 (diff)
parent4e8577ca66d194661b1fed01c46a529655473b97 (diff)
downloadsqlalchemy-5a0c700bb96bf2d80cfbf03f5ddfa97964987e4e.tar.gz
Merge "restore adapter logic in ORM loading"
Diffstat (limited to 'lib/sqlalchemy/orm/loading.py')
-rw-r--r--lib/sqlalchemy/orm/loading.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/loading.py b/lib/sqlalchemy/orm/loading.py
index cd2ec8301..b063635ea 100644
--- a/lib/sqlalchemy/orm/loading.py
+++ b/lib/sqlalchemy/orm/loading.py
@@ -741,6 +741,30 @@ def _instance_processor(
)
else:
getter = None
+ if adapter:
+ # this logic had been removed for all 1.4 releases
+ # up until 1.4.18; the adapter here is particularly
+ # the compound eager adapter which isn't accommodated
+ # in the quick_populators right now. The "fallback"
+ # logic below instead took over in many more cases
+ # until issue #6596 was identified.
+
+ # note there is still an issue where this codepath
+ # produces no "getter" for cases where a joined-inh
+ # mapping includes a labeled column property, meaning
+ # KeyError is caught internally and we fall back to
+ # _getter(col), which works anyway. The adapter
+ # here for joined inh without any aliasing might not
+ # be useful. Tests which see this include
+ # test.orm.inheritance.test_basic ->
+ # EagerTargetingTest.test_adapt_stringency
+ # OptimizedLoadTest.test_column_expression_joined
+ # PolymorphicOnNotLocalTest.test_polymorphic_on_column_prop # noqa E501
+ #
+
+ adapted_col = adapter.columns[col]
+ if adapted_col is not None:
+ getter = result._getter(adapted_col, False)
if not getter:
getter = result._getter(col, False)
if getter: