diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-11-11 12:57:32 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-11-11 12:57:32 -0500 |
commit | 33c378f768c699f3590f168f6c3c86448239268c (patch) | |
tree | 3f040fef0dd9cd03d5e5c4365ac67c27f31fd73f /lib/sqlalchemy/sql/util.py | |
parent | d51a36397e2449afccb9b70d3ec3d13990460124 (diff) | |
download | sqlalchemy-33c378f768c699f3590f168f6c3c86448239268c.tar.gz |
- Fixed bug where the "single table inheritance" criteria would be
added onto the end of a query in some inappropriate situations, such
as when querying from an exists() of a single-inheritance subclass.
fixes #3582
Diffstat (limited to 'lib/sqlalchemy/sql/util.py')
-rw-r--r-- | lib/sqlalchemy/sql/util.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/util.py b/lib/sqlalchemy/sql/util.py index cbd74faac..5def70444 100644 --- a/lib/sqlalchemy/sql/util.py +++ b/lib/sqlalchemy/sql/util.py @@ -203,6 +203,21 @@ def surface_selectables(clause): stack.append(elem.element) +def surface_column_elements(clause): + """traverse and yield only outer-exposed column elements, such as would + be addressable in the WHERE clause of a SELECT if this element were + in the columns clause.""" + + stack = deque([clause]) + while stack: + elem = stack.popleft() + yield elem + for sub in elem.get_children(): + if isinstance(elem, FromGrouping): + continue + stack.append(sub) + + def selectables_overlap(left, right): """Return True if left/right have some overlapping selectable""" |