Michael,

 

Thanks for confirming that, seems it was a strong reference to the session
which was a local function variable, if was being destroyed and
unreferencing my object.

 

I'll look at ways to combat that ;-)

 

Cheers,

 

Heston

 

From: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Michael Bayer
Sent: 10 October 2008 15:25
To: sqlalchemy@googlegroups.com
Subject: [sqlalchemy] Re: object_session(remote_device_object) returns
noneType

 

 

On Oct 10, 2008, at 8:03 AM, Heston James - Cold Beans wrote:





Morning guys,

 

When calling object_session(my_object), it returns a NoneType object so I'm
unable to call commit() and close() on the session, what does this mean?
Does it mean my object is not attached to a session?

 

My understanding is that if I did something like:

 

my_object = session.query(object).get(object_id)

 

then pass my_object around the application and wish to commit its session I
should be able to use the object_session() method to do that? Is that not
correct?

 

 

that is all correct, however if you remove all strong references to the
session, it gets garbage collected and the objects are detached.

 



 


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