summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql_util.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-03-05 23:08:52 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-03-05 23:08:52 +0000
commit9154e1eff1da41c41b31e2a24a6128ff457c7716 (patch)
tree743bb691fc6e06e5b3d43c29a96568f1ac81a66e /lib/sqlalchemy/sql_util.py
parent7693a680edf9776d3037283f3d63e3aeeb06649e (diff)
downloadsqlalchemy-9154e1eff1da41c41b31e2a24a6128ff457c7716.tar.gz
- added concept of 'require_embedded' to corresponding_column.
requires that the target column be present in a sub-element of the target selectable. - embedded logic above more appropriate for ClauseAdapter functionality since its trying to "pull up" clauses that represent columns within a larger union up to the level of the union itself. - the "direction" test against the "foreign_keys" collection apparently works for an exact "column 'x' is present in the collection", no proxy relationships needed. fixes the case of relating a selectable/alias to one of its underlying tables, probably fixes other scenarios
Diffstat (limited to 'lib/sqlalchemy/sql_util.py')
-rw-r--r--lib/sqlalchemy/sql_util.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql_util.py b/lib/sqlalchemy/sql_util.py
index 3eb4b6d06..70fc85702 100644
--- a/lib/sqlalchemy/sql_util.py
+++ b/lib/sqlalchemy/sql_util.py
@@ -178,7 +178,7 @@ class Aliasizer(AbstractClauseProcessor):
class ClauseAdapter(AbstractClauseProcessor):
"""Given a clause (like as in a WHERE criterion), locate columns
- which *correspond* to a given selectable, and changes those
+ which are embedded within a given selectable, and changes those
columns to be that of the selectable.
E.g.::
@@ -219,10 +219,10 @@ class ClauseAdapter(AbstractClauseProcessor):
if self.exclude is not None:
if col in self.exclude:
return None
- newcol = self.selectable.corresponding_column(col, raiseerr=False, keys_ok=False)
+ newcol = self.selectable.corresponding_column(col, raiseerr=False, require_embedded=True, keys_ok=False)
if newcol is None and self.equivalents is not None and col in self.equivalents:
for equiv in self.equivalents[col]:
- newcol = self.selectable.corresponding_column(equiv, raiseerr=False, keys_ok=False)
+ newcol = self.selectable.corresponding_column(equiv, raiseerr=False, require_embedded=True, keys_ok=False)
if newcol:
return newcol
return newcol