From 549e3a5be6a8c6db7183b1f7d20e8f3f39687ef4 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 16 Apr 2022 11:40:13 -0400 Subject: [PATCH] adapt_from_selectables is a set aliasedclass setting this as a list, making all the containment checks more expensive. the presence of the collection also serves as a flag so it has to stay optional. Change-Id: Iafffbeb29d77441ca35ecd8048244ee6eed1232c (cherry picked from commit c538f810bce57472c8960a0a6c4c61024b00f3ed) --- lib/sqlalchemy/orm/util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sqlalchemy/orm/util.py b/lib/sqlalchemy/orm/util.py index 9ec2ad0768..50ac8917d3 100644 --- a/lib/sqlalchemy/orm/util.py +++ b/lib/sqlalchemy/orm/util.py @@ -708,11 +708,11 @@ class AliasedInsp( # make sure the adapter doesn't try to grab other tables that # are not even the thing we are mapping, such as embedded # selectables in subqueries or CTEs. See issue #6060 - adapt_from_selectables=[ + adapt_from_selectables={ m.selectable for m in self.with_polymorphic_mappers if not adapt_on_names - ], + }, ) if nest_adapters: -- 2.47.2