On Jan 14, 2009, at 12:58 PM, koranthala wrote:
> > Hi, > I moved my application from 0.4 to 0.5 and now I am finding that it > is not working - the error is -> > sqlalchemy.exc.UnboundExecutionError: Instance <Data at 0x1357110> is > not bound to a Session; attribute refresh operation cannot proceed > > I read through other mail chains and it looks like removal of > get_session() method on Mapper is the reason for this. > I actually take objects from one session to pass it to other > threads where the data is modified and saved. So, I cannot keep the > session open across threads (at least not without introducing kludgy > code). > > Is there any way of handling this - should I go back to 0.4? get_session() created implicit behavior of placing an object in a session when none was available, so your application could be surprised to find an object bound to a certain session, which could later cause thread-unsafe access if the object were moved to yet another thread but not removed from the previous session. so take your existing logic which removes the object from one session and passes to a new thread to also add() (or merge()) the object to the session corresponding to that thread. your code will be better off for its explicitness in this area. --~--~---------~--~----~------------~-------~--~----~ 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 sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---