summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/interfaces.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-08-21 18:48:34 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-08-21 18:49:34 -0400
commit09b93477d26e8298c255b98eb0d6371839bbfa87 (patch)
treea656a710c250500a499738dfabd489f87679b66d /lib/sqlalchemy/orm/interfaces.py
parent78c339a113e9e679c44ddfe52fc40a6a1c7ecf4e (diff)
downloadsqlalchemy-09b93477d26e8298c255b98eb0d6371839bbfa87.tar.gz
move FAQ to the docs, [ticket:2133]
Conflicts: doc/build/index.rst
Diffstat (limited to 'lib/sqlalchemy/orm/interfaces.py')
-rw-r--r--lib/sqlalchemy/orm/interfaces.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/interfaces.py b/lib/sqlalchemy/orm/interfaces.py
index 70743624c..55a01a237 100644
--- a/lib/sqlalchemy/orm/interfaces.py
+++ b/lib/sqlalchemy/orm/interfaces.py
@@ -234,7 +234,26 @@ class MapperProperty(_MappedAttribute, _InspectionAttr):
@property
def class_attribute(self):
"""Return the class-bound descriptor corresponding to this
- MapperProperty."""
+ :class:`.MapperProperty`.
+
+ This is basically a ``getattr()`` call::
+
+ return getattr(self.parent.class_, self.key)
+
+ I.e. if this :class:`.MapperProperty` were named ``addresses``,
+ and the class to which it is mapped is ``User``, this sequence
+ is possible::
+
+ >>> from sqlalchemy import inspect
+ >>> mapper = inspect(User)
+ >>> addresses_property = mapper.attrs.addresses
+ >>> addresses_property.class_attribute is User.addresses
+ True
+ >>> User.addresses.property is addresses_property
+ True
+
+
+ """
return getattr(self.parent.class_, self.key)