[sqlalchemy] Re: Proposal: session identity_map no longer weak referencing

2006-12-09 Thread Alan Franzoni

  when SA was first released, someone immediately suggested that the
  identity map of Session be weak referencing, which appeared to be an
  obvious improvement, so that you could load as many objects as you want
  from the session and whatever you didnt use would just go away.  but
  now it appears that the more intuitive operation for a Session is that
  things that get loaded into it, stay there, until you say otherwise.


If I got what yoy mean, I think I had suggested something like that
myself... but it was back in SA 0.1 days, when there was no explicit
Session.

But are you saying that doing sth like

a = MappedObject()

session.save(a)

del a


would prevent 'a' from being saved when flushing the session? In SA 0.3.1 it
seems to stay in it. Or it's just a matter of changed attributes, something
like

a = query.get_by(id=x)
a.attribute = 4
del a


?

In both cases, I think the strongly referenced behaviour is OK. If it's in a
session, I want an object to be tracked whatsoever, unless I explicitly
remove it.

-- 
Alan Franzoni [EMAIL PROTECTED]
-
Togli .xyz dalla mia email per contattarmi.
Remove .xyz from my address in order to contact me.
-
GPG Key Fingerprint (Key ID = FE068F3E):
5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E


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


[sqlalchemy] Re: Proposal: session identity_map no longer weak referencing

2006-12-08 Thread Jonathan Ellis

On 12/8/06, Michael Bayer [EMAIL PROTECTED] wrote:
 when SA was first released, someone immediately suggested that the
 identity map of Session be weak referencing, which appeared to be an
 obvious improvement, so that you could load as many objects as you want
 from the session and whatever you didnt use would just go away.  but
 now it appears that the more intuitive operation for a Session is that
 things that get loaded into it, stay there, until you say otherwise.

 So id like to make the session act this way, again like
 hibernate's...more explicit.  what you load into the session stays
 there until you clean it out.  that behavior is more predictable than
 what we have now.

+1

 Of course we can always add an option weak_identity_map if people
 really do want the old behavior.

-1, it's only a matter of time before this would bite you

-- 
Jonathan Ellis
http://spyced.blogspot.com

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