From ceaa6047ef8bc3916ffdda1924844cbf233dfd94 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 20 Feb 2014 16:14:29 -0500 Subject: - More fixes to SQLite "join rewriting"; the fix from :ticket:`2967` implemented right before the release of 0.9.3 affected the case where a UNION contained nested joins in it. "Join rewriting" is a feature with a wide range of possibilities and is the first intricate "SQL rewriting" feature we've introduced in years, so we're sort of going through a lot of iterations with it (not unlike eager loading back in the 0.2/0.3 series, polymorphic loading in 0.4/0.5). We should be there soon so thanks for bearing with us :). fixes #2969 re: #2967 - solve the issue of join rewriting inspecting various types of from objects without using isinstance(), by adding some new underscored inspection flags to the FromClause hierarchy. --- lib/sqlalchemy/sql/selectable.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/sqlalchemy/sql/selectable.py') diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py index bda3d655e..59d6687b5 100644 --- a/lib/sqlalchemy/sql/selectable.py +++ b/lib/sqlalchemy/sql/selectable.py @@ -137,6 +137,10 @@ class FromClause(Selectable): named_with_column = False _hide_froms = [] + _is_join = False + _is_select = False + _is_from_container = False + _textual = False """a marker that allows us to easily distinguish a :class:`.TextAsFrom` or similar object from other kinds of :class:`.FromClause` objects.""" @@ -504,6 +508,8 @@ class Join(FromClause): """ __visit_name__ = 'join' + _is_join = True + def __init__(self, left, right, onclause=None, isouter=False): """Construct a new :class:`.Join`. @@ -910,6 +916,8 @@ class Alias(FromClause): __visit_name__ = 'alias' named_with_column = True + _is_from_container = True + def __init__(self, selectable, name=None): baseselectable = selectable while isinstance(baseselectable, Alias): @@ -1716,6 +1724,8 @@ class CompoundSelect(GenerativeSelect): INTERSECT = util.symbol('INTERSECT') INTERSECT_ALL = util.symbol('INTERSECT ALL') + _is_from_container = True + def __init__(self, keyword, *selects, **kwargs): self._auto_correlate = kwargs.pop('correlate', False) self.keyword = keyword @@ -1982,6 +1992,7 @@ class Select(HasPrefixes, GenerativeSelect): _correlate = () _correlate_except = None _memoized_property = SelectBase._memoized_property + _is_select = True def __init__(self, columns=None, -- cgit v1.2.1