]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
if anybody complains that they didn't know it was called "relation" in 0.5, why....
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 18 Mar 2010 00:49:41 +0000 (20:49 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 18 Mar 2010 00:49:41 +0000 (20:49 -0400)
doc/build/mappers.rst
doc/build/ormtutorial.rst
doc/build/reference/orm/mapping.rst
lib/sqlalchemy/ext/declarative.py
lib/sqlalchemy/orm/__init__.py

index ec1bb5e188203f52c115e185f53983d0b76f4d33..c6ae0c85dcd98bb11778e4dc3b4c5fd34da509e2 100644 (file)
@@ -895,7 +895,8 @@ Relationship Configuration
 Basic Relational Patterns
 --------------------------
 
-A quick walkthrough of the basic relational patterns.
+A quick walkthrough of the basic relational patterns.   Note that the :func:`~sqlalchemy.orm.relationship()` function is known as :func:`~sqlalchemy.orm.relation()`
+in all SQLAlchemy versions prior to 0.6beta2, including the 0.5 and 0.4 series.
 
 One To Many
 ~~~~~~~~~~~~
index fae23486eaf616535ef3682fec23f7cbd621ab1c..616adae00b678f5413885956fff0acc4864ac97c 100644 (file)
@@ -700,6 +700,8 @@ Now let's consider a second table to be dealt with.  Users in our system also ca
 
 The above class introduces a **foreign key** constraint which references the ``users`` table.  This defines for SQLAlchemy the relationship between the two tables at the database level.  The relationship between the ``User`` and ``Address`` classes is defined separately using the :func:`~sqlalchemy.orm.relationship()` function, which defines an attribute ``user`` to be placed on the ``Address`` class, as well as an ``addresses`` collection to be placed on the ``User`` class.  Such a relationship is known as a **bidirectional** relationship.   Because of the placement of the foreign key, from ``Address`` to ``User`` it is **many to one**, and from ``User`` to ``Address`` it is **one to many**.  SQLAlchemy is automatically aware of many-to-one/one-to-many based on foreign keys.
 
+.. note:: The :func:`~sqlalchemy.orm.relationship()` function has historically been known as :func:`~sqlalchemy.orm.relation()`, which is the name that's available in all versions of SQLAlchemy prior to 0.6beta2, including the 0.5 and 0.4 series. :func:`~sqlalchemy.orm.relationship()` is only available starting with SQLAlchemy 0.6beta2.  :func:`~sqlalchemy.orm.relation()` will remain available in SQLAlchemy for the foreseeable future to enable cross-compatibility.
+
 The :func:`~sqlalchemy.orm.relationship()` function is extremely flexible, and could just have easily been defined on the ``User`` class:
 
 .. sourcecode:: python+sql
@@ -1068,7 +1070,7 @@ The :class:`~sqlalchemy.orm.query.Query` features several operators which make u
     {stop}[]
 
 Common Relationship Operators
--------------------------
+-----------------------------
 
 Here's all the operators which build on relationships:
 
index e6d3a66669bcc27982c2f57b9f92f248f0849e78..b8842d8dc8b12b3d0dfdc84297891aaf90fe0a2c 100644 (file)
@@ -38,6 +38,8 @@ call::
 
 .. autofunction:: dynamic_loader
 
+.. autofunction:: relation
+
 .. autofunction:: relationship
 
 .. autofunction:: synonym
index c6423e7a0d10d686d784f93b74efaddd873f3672..0f55180451c49507297e65760fe132c2ac0fb899 100644 (file)
@@ -100,8 +100,11 @@ Configuring Relationships
 =========================
 
 Relationships to other classes are done in the usual way, with the added
-feature that the class specified to :func:`~sqlalchemy.orm.relationship()`
-may be a string name.  The "class registry" associated with ``Base``
+feature that the class specified to :func:`~sqlalchemy.orm.relationship`
+may be a string name (note that :func:`~sqlalchemy.orm.relationship` is 
+only available as of SQLAlchemy 0.6beta2, and in all prior versions is known
+as :func:`~sqlalchemy.orm.relation`, 
+including 0.5 and 0.4).  The "class registry" associated with ``Base``
 is used at mapper compilation time to resolve the name into the actual
 class object, which is expected to have been defined once the mapper
 configuration is used:: 
index 26cb071b767d7b7be2a5b0820cfc289a4fb2b61f..3337287d8828af9e3fa7a3194f786bfd1216fb9d 100644 (file)
@@ -175,7 +175,13 @@ def create_session(bind=None, **kwargs):
 
 def relationship(argument, secondary=None, **kwargs):
     """Provide a relationship of a primary Mapper to a secondary Mapper.
-
+    
+    .. note:: This function is known as :func:`relation` in all versions
+      of SQLAlchemy prior to version 0.6beta2, including the 0.5 and 0.4 series.
+      :func:`~sqlalchemy.orm.relationship()` is only available starting with 
+      SQLAlchemy 0.6beta2.  The :func:`relation` name will remain available for 
+      the foreseeable future in order to enable cross-compatibility.
+    
     This corresponds to a parent-child or associative table relationship.  The
     constructed class is an instance of :class:`RelationshipProperty`.