Hello -

Over here at SQLAlchemy labs, we have a new branch available against
0.4 which I am considering merging (well, most of it will probably be
merged regardless for architectural cleanup purposes, but theres one
particular feature in question).  The primary behavioral change is
that the identity map within the Session again becomes "weak
referencing", the way it used to be back in 0.2 and part of 0.3.

While we've had an option on Session to use a "weak referencing"
identity map for a long time, it was an incomplete solution, since
objects which had pending changes on them (i.e. "dirty") would get
garbage collected if external references were removed.

With this new approach, we have reorganized how mapped objects are
tracked and built our own version of WeakValueDictionary, which will
detect "dirty" objects as they are dereferenced and recreate them
internally so that pending changes are still persisted, even if
external references to the object are dropped; but unchanged objects
get removed from the session automatically when dereferenced on the
outside.

I bring all this up here for two reasons:

1. Do you guys want a weak-referencing identity map ?  It would remove
the need to "prune" sessions which are growing too large with old
objects.  Right now whatever goes into a session stays that way until
you explicitly expunge(), clear() or prune().

2. If we do merge it, beta6 would be the "testing ground" for the new
idea, which does contain some possible concurrency situations and
therefore some new mutex-code, which while its pretty straightforward,
always introduces the chance of issues when beta6 comes out (since its
hard to recreate threading issues on various platforms, ive noticed my
own platform of OSX is particularly bad at finding sync bugs).

OK, reason number 3.  The new branch is at
http://svn.sqlalchemy.org/sqlalchemy/branches/entity_management , and
the threaded part of the equation, if people want to review, is at
http://www.sqlalchemy.org/trac/browser/sqlalchemy/branches/entity_management/lib/sqlalchemy/orm/attributes.py
, using the "InstanceState" and "InstanceDict" classes (InstanceDict
forms the basis for the session.identity_map attribute).

- mike


--~--~---------~--~----~------------~-------~--~----~
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