]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
document identity_map
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 11 Feb 2012 15:52:00 +0000 (10:52 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 11 Feb 2012 15:52:00 +0000 (10:52 -0500)
doc/build/orm/session.rst
lib/sqlalchemy/orm/session.py

index 298f2ea29904b2a9036ad783b2a8942ae80777fc..4bb1738ba00bed4d3f385de8c0a9f1553f387156 100644 (file)
@@ -890,6 +890,13 @@ all objects which have had changes since they were last loaded or saved (i.e.
     # persistent objects that have been marked as deleted via session.delete(obj)
     session.deleted
 
+    # dictionary of all persistent objects, keyed on their
+    # identity key
+    session.identity_map
+
+(Documentation: :attr:`.Session.new`, :attr:`.Session.dirty`, 
+:attr:`.Session.deleted`, :attr:`.Session.identity_map`).
+
 Note that objects within the session are by default *weakly referenced*. This
 means that when they are dereferenced in the outside application, they fall
 out of scope from within the :class:`~sqlalchemy.orm.session.Session` as well
index 4299290d0d5fa17dbe9b6bfc63330d1b50aa714d..ba6ceaeeca568a94e7e578b80e7651f811a23b04 100644 (file)
@@ -1772,6 +1772,19 @@ class Session(object):
 
         return self.transaction and self.transaction.is_active
 
+    identity_map = None
+    """A mapping of object identities to objects themselves.
+    
+    Iterating through ``Session.identity_map.values()`` provides
+    access to the full set of persistent objects (i.e., those 
+    that have row identity) currently in the session.
+    
+    See also:
+    
+    :func:`.identity_key` - operations involving identity keys.
+    
+    """
+
     @property
     def _dirty_states(self):
         """The set of all persistent states considered dirty.