I noticed that Session has no method len. Wouldn't it be useful to add
one, like this:

--- orm/session.py      2007-07-06 14:38:22.000000000 +0200
+++ orm/session.py.orig 2007-07-06 14:43:48.000000000 +0200
@@ -642,6 +642,9 @@
     def __iter__(self):
         return iter(list(self.uow.new) +
self.uow.identity_map.values())

+    def __len__(self):
+        return len(self.uow.new) + len(self.uow.identity_map)
+
     def _get(self, key):
         return self.identity_map[key]

Then, one could flush() and clear() it if it grows too large.
(Generally, I think any class with __iter__ should have __len__ too.)

Best regards
  Klaus


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to