diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-07-16 17:29:02 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-07-16 17:29:02 -0400 |
commit | ce9a702dbd52946487f45b98ef20d1b7783facb6 (patch) | |
tree | 7273a1982850bf9975509295d766053d4fe822b1 /lib/sqlalchemy/sql/expression.py | |
parent | 1dc09bf6ede97ef08b2c8c0886a03b44bba735ff (diff) | |
download | sqlalchemy-ce9a702dbd52946487f45b98ef20d1b7783facb6.tar.gz |
- express most of the orm.util functions in terms of the inspection system
- modify inspection system:
1. raise a new exception for any case where the inspection
context can't be returned. this supersedes the "not mapped"
errors.
2. don't configure mappers on a mapper inspection. this allows
the inspectors to be used during mapper config time. instead,
the mapper configures on "with_polymorphic_selectable" now,
which is needed for all queries
- add a bunch of new "is_XYZ" attributes to inspectors
- finish making the name change of "compile" -> "configure", for some reason
this was only done partially
Diffstat (limited to 'lib/sqlalchemy/sql/expression.py')
-rw-r--r-- | lib/sqlalchemy/sql/expression.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index 631a1b205..46873c859 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -29,7 +29,7 @@ to stay the same in future releases. import itertools, re from operator import attrgetter -from .. import util, exc +from .. import util, exc, inspection from . import operators from .operators import ColumnOperators from .visitors import Visitable, cloned_traverse @@ -1525,6 +1525,7 @@ class ClauseElement(Visitable): _from_objects = [] bind = None _is_clone_of = None + is_selectable = False def _clone(self): """Create a shallow copy of this ClauseElement. @@ -1841,6 +1842,8 @@ class ClauseElement(Visitable): return '<%s.%s at 0x%x; %s>' % ( self.__module__, self.__class__.__name__, id(self), friendly) +inspection._self_inspects(ClauseElement) + class _Immutable(object): """mark a ClauseElement as 'immutable' when expressions are cloned.""" @@ -2394,6 +2397,12 @@ class Selectable(ClauseElement): """mark a class as being selectable""" __visit_name__ = 'selectable' + is_selectable = True + + @property + def selectable(self): + return self + class FromClause(Selectable): """Represent an element that can be used within the ``FROM`` clause of a ``SELECT`` statement. |