summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-11-18 18:54:48 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2010-11-18 18:54:48 -0500
commitccf77190f986095834220ece160992e224dcc587 (patch)
tree28ee6659904db5cc18e7d974a679483eaf5520c8 /doc
parent98674959d25040d4d7ca3c95bbfb422cbb23c20e (diff)
parent2336b1cebfcb2f304e09cbc2a0e8bb3fb3a9ceeb (diff)
downloadsqlalchemy-ccf77190f986095834220ece160992e224dcc587.tar.gz
merge tip
Diffstat (limited to 'doc')
-rw-r--r--doc/build/orm/mapper_config.rst29
1 files changed, 27 insertions, 2 deletions
diff --git a/doc/build/orm/mapper_config.rst b/doc/build/orm/mapper_config.rst
index a8b86abcd..40512f520 100644
--- a/doc/build/orm/mapper_config.rst
+++ b/doc/build/orm/mapper_config.rst
@@ -142,6 +142,33 @@ together using a list, as below where we map to a :func:`~.expression.join`::
For further examples on this particular use case, see :ref:`maptojoin`.
+column_property API
+~~~~~~~~~~~~~~~~~~~
+
+The establishment of a :class:`.Column` on a :func:`.mapper` can be further
+customized using the :func:`.column_property` function, as specified
+to the ``properties`` dictionary. This function is
+usually invoked implicitly for each mapped :class:`.Column`. Explicit usage
+looks like::
+
+ from sqlalchemy.orm import mapper, column_property
+
+ mapper(User, users, properties={
+ 'name':column_property(users.c.name, active_history=True)
+ })
+
+or with declarative::
+
+ class User(Base):
+ __tablename__ = 'users'
+
+ id = Column(Integer, primary_key=True)
+ name = column_property(Column(String(50)), active_history=True)
+
+Further examples of :func:`.column_property` are at :ref:`mapper_sql_expressions`.
+
+.. autofunction:: column_property
+
.. _deferred:
Deferred Column Loading
@@ -267,8 +294,6 @@ Correlated subqueries may be used as well::
The declarative form of the above is described in :ref:`declarative_sql_expressions`.
-.. autofunction:: column_property
-
Note that :func:`.column_property` is used to provide the effect of a SQL
expression that is actively rendered into the SELECT generated for a
particular mapped class. Alternatively, for the typical attribute that