]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
update query.update(), query.delete(), sessionevents.after_bulk_update(), sessioneven...
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 6 Dec 2011 16:53:49 +0000 (11:53 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 6 Dec 2011 16:53:49 +0000 (11:53 -0500)
lib/sqlalchemy/orm/events.py
lib/sqlalchemy/orm/query.py

index 784ef10fdd09943fe817a602addfbbdf7ade4a85..74971676d7c0b778bff8a787888c83139d1802d2 100644 (file)
@@ -918,9 +918,6 @@ class SessionEvents(event.Events):
     def before_flush( self, session, flush_context, instances):
         """Execute before flush process has started.
 
-        `instances` is an optional list of objects which were passed to
-        the ``flush()`` method. 
-        
         :param session: The target :class:`.Session`.
         :param flush_context: Internal :class:`.UOWTransaction` object
          which handles the details of the flush.
@@ -961,9 +958,6 @@ class SessionEvents(event.Events):
     def after_begin( self, session, transaction, connection):
         """Execute after a transaction is begun on a connection
 
-        `transaction` is the SessionTransaction. This method is called
-        after an engine level transaction is begun on a connection. 
-        
         :param session: The target :class:`.Session`.
         :param transaction: The :class:`.SessionTransaction`.
         :param connection: The :class:`~.engine.base.Connection` object 
@@ -979,21 +973,29 @@ class SessionEvents(event.Events):
     def after_bulk_update( self, session, query, query_context, result):
         """Execute after a bulk update operation to the session.
 
-        This is called after a session.query(...).update()
+        This is called as a result of the :meth:`.Query.update` method.
+
+        :param query: the :class:`.Query` object that this update operation was
+         called upon. 
+        :param query_context: The :class:`.QueryContext` object, corresponding
+         to the invocation of an ORM query.
+        :param result: the :class:`.ResultProxy` returned as a result of the
+         bulk UPDATE operation.
 
-        `query` is the query object that this update operation was
-        called on. `query_context` was the query context object.
-        `result` is the result object returned from the bulk operation.
         """
 
     def after_bulk_delete( self, session, query, query_context, result):
         """Execute after a bulk delete operation to the session.
 
-        This is called after a session.query(...).delete()
+        This is called as a result of the :meth:`.Query.delete` method.
+
+        :param query: the :class:`.Query` object that this update operation was
+         called upon. 
+        :param query_context: The :class:`.QueryContext` object, corresponding
+         to the invocation of an ORM query.
+        :param result: the :class:`.ResultProxy` returned as a result of the
+         bulk DELETE operation.
 
-        `query` is the query object that this delete operation was
-        called on. `query_context` was the query context object.
-        `result` is the result object returned from the bulk operation.
         """
 
 
index d8f9dc691389b7e093007c3ba5aa55dc6b3d238f..156c40b60de1cab1bc92e318506a6b2081a46021 100644 (file)
@@ -2407,7 +2407,7 @@ class Query(object):
         :param synchronize_session: chooses the strategy for the removal of
             matched objects from the session. Valid values are:
 
-            False - don't synchronize the session. This option is the most
+            ``False`` - don't synchronize the session. This option is the most
             efficient and is reliable once the session is expired, which
             typically occurs after a commit(), or explicitly using
             expire_all(). Before the expiration, objects may still remain in
@@ -2415,12 +2415,12 @@ class Query(object):
             results if they are accessed via get() or already loaded
             collections.
 
-            'fetch' - performs a select query before the delete to find
+            ``'fetch'`` - performs a select query before the delete to find
             objects that are matched by the delete query and need to be
             removed from the session. Matched objects are removed from the
             session.
 
-            'evaluate' - Evaluate the query's criteria in Python straight on
+            ``'evaluate'`` - Evaluate the query's criteria in Python straight on
             the objects in the session. If evaluation of the criteria isn't
             implemented, an error is raised.  In that case you probably 
             want to use the 'fetch' strategy as a fallback.
@@ -2437,10 +2437,10 @@ class Query(object):
         state of dependent objects subject to delete or delete-orphan cascade
         to be correctly represented.
 
-        Also, the ``before_delete()`` and ``after_delete()``
-        :class:`~sqlalchemy.orm.interfaces.MapperExtension` methods are not
-        called from this method. For a delete hook here, use the
-        :meth:`.SessionExtension.after_bulk_delete()` event hook.
+        Note that the :meth:`.MapperEvents.before_delete` and 
+        :meth:`.MapperEvents.after_delete`
+        events are **not** invoked from this method.  It instead
+        invokes :meth:`.SessionEvents.after_bulk_delete`.
 
         """
         #TODO: lots of duplication and ifs - probably needs to be 
@@ -2535,18 +2535,18 @@ class Query(object):
         :param synchronize_session: chooses the strategy to update the
             attributes on objects in the session. Valid values are:
 
-            False - don't synchronize the session. This option is the most
+            ``False`` - don't synchronize the session. This option is the most
             efficient and is reliable once the session is expired, which
             typically occurs after a commit(), or explicitly using
             expire_all(). Before the expiration, updated objects may still
             remain in the session with stale values on their attributes, which
             can lead to confusing results.
 
-            'fetch' - performs a select query before the update to find
+            ``'fetch'`` - performs a select query before the update to find
             objects that are matched by the update query. The updated
             attributes are expired on matched objects.
 
-            'evaluate' - Evaluate the Query's criteria in Python straight on
+            ``'evaluate'`` - Evaluate the Query's criteria in Python straight on
             the objects in the session. If evaluation of the criteria isn't
             implemented, an exception is raised.
 
@@ -2563,10 +2563,10 @@ class Query(object):
         or call expire_all()) in order for the state of dependent objects
         subject foreign key cascade to be correctly represented.
 
-        Also, the ``before_update()`` and ``after_update()``
-        :class:`~sqlalchemy.orm.interfaces.MapperExtension` methods are not
-        called from this method. For an update hook here, use the
-        :meth:`.SessionExtension.after_bulk_update()` event hook.
+        Note that the :meth:`.MapperEvents.before_update` and 
+        :meth:`.MapperEvents.after_update`
+        events are **not** invoked from this method.  It instead
+        invokes :meth:`.SessionEvents.after_bulk_update`.
 
         """