Re: [Sqlalchemy-tickets] [sqlalchemy] #2419: column targeting failure with any() + joinedload + joi
Brought to you by:
zzzeek
From: sqlalchemy <mi...@zz...> - 2012-02-28 19:35:51
|
#2419: column targeting failure with any() + joinedload + join to joined inh + limit ------------------------------+--------------------------------------- Reporter: zzzeek | Owner: zzzeek Type: defect | Status: new Priority: high | Milestone: 0.7.6 Component: orm | Severity: very major - up to 2 days Resolution: | Keywords: Progress State: needs tests | ------------------------------+--------------------------------------- Comment (by zzzeek): here's a refinement: {{{ #!diff diff -r 659e55828d2a lib/sqlalchemy/sql/expression.py --- a/lib/sqlalchemy/sql/expression.py Mon Feb 27 11:14:46 2012 -0500 +++ b/lib/sqlalchemy/sql/expression.py Tue Feb 28 14:35:30 2012 -0500 @@ -2466,6 +2466,13 @@ """ + def embedded(expanded_proxy_set, target_set): + for t in target_set.difference(expanded_proxy_set): + if not set(_expand_cloned([t]) + ).intersection(expanded_proxy_set): + return False + return True + # dont dig around if the column is locally present if self.c.contains_column(column): return column @@ -2473,10 +2480,10 @@ target_set = column.proxy_set cols = self.c for c in cols: - i = target_set.intersection(itertools.chain(*[p._cloned_set - for p in c.proxy_set])) + expanded_proxy_set = set(_expand_cloned(c.proxy_set)) + i = target_set.intersection(expanded_proxy_set) if i and (not require_embedded - or c.proxy_set.issuperset(target_set)): + or embedded(expanded_proxy_set, target_set)): if col is None: # no corresponding column yet, pick this one. }}} -- Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2419#comment:9> sqlalchemy <http://www.sqlalchemy.org/> The Database Toolkit for Python |