]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- add cross-linking for passive_deletes / passive_updates
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 16 Feb 2014 17:43:46 +0000 (12:43 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 16 Feb 2014 17:43:46 +0000 (12:43 -0500)
doc/build/orm/collections.rst
doc/build/orm/relationships.rst
lib/sqlalchemy/orm/mapper.py
lib/sqlalchemy/orm/relationships.py

index 053369baa7bea305103f9bd4b38fd0dc9e4e8cd5..354cfbca458d9e049aecf3b8178fac5c0d05bb7c 100644 (file)
@@ -112,7 +112,7 @@ from the database, the ``children`` collection stays empty.
 Using Passive Deletes
 ----------------------
 
-Use ``passive_deletes=True`` to disable child object loading on a DELETE
+Use :paramref:`~.relationship.passive_deletes` to disable child object loading on a DELETE
 operation, in conjunction with "ON DELETE (CASCADE|SET NULL)" on your database
 to automatically cascade deletes to child objects::
 
@@ -142,7 +142,7 @@ to automatically cascade deletes to child objects::
     * When using SQLite, foreign key support must be enabled explicitly.
       See :ref:`sqlite_foreign_keys` for details.
 
-When ``passive_deletes`` is applied, the ``children`` relationship will not be
+When :paramref:`~.relationship.passive_deletes` is applied, the ``children`` relationship will not be
 loaded into memory when an instance of ``MyClass`` is marked for deletion. The
 ``cascade="all, delete-orphan"`` *will* take effect for instances of
 ``MyOtherClass`` which are currently present in the session; however for
index 1441ef55be252623c070e13764c636b900db6fe3..c6a43e28ce5606dd79ca348ea562c56191c778b4 100644 (file)
@@ -221,8 +221,8 @@ There are several possibilities here:
   this feature, the database itself can be made to automatically delete rows in the
   "secondary" table as referencing rows in "child" are deleted.   SQLAlchemy
   can be instructed to forego actively loading in the ``Child.parents``
-  collection in this case using the ``passive_deletes=True`` directive
-  on :func:`.relationship`; see :ref:`passive_deletes` for more details
+  collection in this case using the :paramref:`~.relationship.passive_deletes`
+  directive on :func:`.relationship`; see :ref:`passive_deletes` for more details
   on this.
 
 Note again, these behaviors are *only* relevant to the ``secondary`` option
@@ -1563,13 +1563,13 @@ of sync for any moment.
 
 For databases that don't support this, such as SQLite and
 MySQL without their referential integrity options turned
-on, the ``passive_updates`` flag can
+on, the :paramref:`~.relationship.passive_updates` flag can
 be set to ``False``, most preferably on a one-to-many or
 many-to-many :func:`.relationship`, which instructs
 SQLAlchemy to issue UPDATE statements individually for
 objects referenced in the collection, loading them into
 memory if not already locally present. The
-``passive_updates`` flag can also be ``False`` in
+:paramref:`~.relationship.passive_updates` flag can also be ``False`` in
 conjunction with ON UPDATE CASCADE functionality,
 although in that case the unit of work will be issuing
 extra SELECT and UPDATE statements unnecessarily.
@@ -1594,16 +1594,17 @@ A typical mutable primary key setup might look like::
                     ForeignKey('user.username', onupdate="cascade")
                 )
 
-``passive_updates`` is set to ``True`` by default,
+:paramref:`~.relationship.passive_updates` is set to ``True`` by default,
 indicating that ON UPDATE CASCADE is expected to be in
 place in the usual case for foreign keys that expect
 to have a mutating parent key.
 
-``passive_updates=False`` may be configured on any
+A :paramref:`~.relationship.passive_updates` setting of False may be configured on any
 direction of relationship, i.e. one-to-many, many-to-one,
 and many-to-many, although it is much more effective when
 placed just on the one-to-many or many-to-many side.
-Configuring the ``passive_updates=False`` only on the
+Configuring the :paramref:`~.relationship.passive_updates`
+to False only on the
 many-to-one side will have only a partial effect, as the
 unit of work searches only through the current identity
 map for objects that may be referencing the one with a
index 70df9a679c865edc37f8fab09ec2c3d170694606..4747c075da90ed582ae25654d4b3af34216010e1 100644 (file)
@@ -315,11 +315,11 @@ class Mapper(_InspectionAttr):
 
            When False, it is assumed that the database does not enforce
            referential integrity and will not be issuing its own CASCADE
-           operation for an update.  The :class:`.Mapper` here will
+           operation for an update.  The unit of work process will
            emit an UPDATE statement for the dependent columns during a
            primary key change.
 
-           ..seealso::
+           .. seealso::
 
                :ref:`passive_updates` - description of a similar feature as
                used with :func:`.relationship`
index 879fe7c78672bf4e7a98e6080562b10140b48356..46dd91c6ea1c0d12f020e35262228e2ac9f31912 100644 (file)
@@ -514,6 +514,11 @@ class RelationshipProperty(StrategizedProperty):
            after a flush occurs so this is a very special use-case
            setting.
 
+           .. seealso::
+
+                :ref:`passive_deletes` - Introductory documentation
+                and examples.
+
         :param passive_updates=True:
           Indicates loading and INSERT/UPDATE/DELETE behavior when the
           source of a foreign key value changes (i.e. an "on update"
@@ -540,10 +545,16 @@ class RelationshipProperty(StrategizedProperty):
           are expected and the database in use doesn't support CASCADE
           (i.e. SQLite, MySQL MyISAM tables).
 
+          .. seealso::
+
+                :ref:`passive_updates` - Introductory documentation and
+                examples.
+
+                :paramref:`.mapper.passive_updates` - a similar flag which
+                takes effect for joined-table inheritance mappings.
+
           Also see the passive_updates flag on ``mapper()``.
 
-          A future SQLAlchemy release will provide a "detect" feature for
-          this flag.
 
         :param post_update:
           this indicates that the relationship should be handled by a