diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-10-26 19:25:23 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-10-26 19:25:23 -0400 |
commit | d68bf88fa9147591a245f23562154d9562e4b744 (patch) | |
tree | 609931e247dcff1b5f0012b31020afc190e8092b /lib/sqlalchemy/orm/attributes.py | |
parent | 7f043a9666eecdecc54fe779ffdd50a7d5bb0086 (diff) | |
download | sqlalchemy-d68bf88fa9147591a245f23562154d9562e4b744.tar.gz |
- add class_ to AliasedInsp
- redefine inspect(Class.attrname).parent to be always an inspectable
target; either Mapper or AliasedInsp
- add most major features to 08 migration, document, link
Diffstat (limited to 'lib/sqlalchemy/orm/attributes.py')
-rw-r--r-- | lib/sqlalchemy/orm/attributes.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index 7effd8e58..983b4dfec 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -158,9 +158,17 @@ class QueryableAttribute(interfaces._MappedAttribute, # TODO: conditionally attach this method based on clause_element ? return self - @property + @util.memoized_property def parent(self): - return self._parententity + """Return an inspection instance representing the parent. + + This will be either an instance of :class:`.Mapper` + or :class:`.AliasedInsp`, depending upon the nature + of the parent entity which this attribute is associated + with. + + """ + return inspection.inspect(self._parententity) @property def expression(self): @@ -208,6 +216,15 @@ class QueryableAttribute(interfaces._MappedAttribute, @util.memoized_property def property(self): + """Return the :class:`.MapperProperty` associated with this + :class:`.QueryableAttribute`. + + + Return values here will commonly be instances of + :class:`.ColumnProperty` or :class:`.RelationshipProperty`. + + + """ return self.comparator.property inspection._self_inspects(QueryableAttribute) |