From: Mike Bayer Date: Sat, 16 Apr 2022 15:40:13 +0000 (-0400) Subject: adapt_from_selectables is a set X-Git-Tag: rel_1_4_36~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=549e3a5be6a8c6db7183b1f7d20e8f3f39687ef4;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git 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) --- 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: