Thx Michael. Well, I don't think that I am doing that. To give you a picture of the object model this is how the hierarchy is:
BaseOrmDao (+GetSession() this returns the session attached to the current thread) ^ | Request - > PreProcessor <-> Controller <-> Manager <-> DaoFactory <-> DAOs | V (orm.session attached to thread here) To clarify the DaoFactory will return a new DAO object back to the manager always, that means a DAO object. Also, a new instance of Controller and Manager is made per request. To answer your question there is no point in the communication where two threads share the same object. (Not sure if SQLAlchemy does so when mapped objects are used in the DAO layer ?) Any thoughts? On 7/13/07, Michael Bayer <[EMAIL PROTECTED]> wrote: > > > > On Jul 13, 2007, at 2:27 AM, Arun Kumar PG wrote: > > > I create an orm session as soon as the request comes in and store > > the reference to the same in the curent thread i.e. > > threading.currentThread().session = new_session. This session is > > stored in the current thread so that I can get the same session > > across all DAO objects. so basically ever DAO in the request chain > > can simply get the session by saying > > threading.currenrThread.session and use it. Finally, once the > > request is over this session object is removed from the current > > thread i.e. del <session>. > > > > I can see that during multiple request the thread ids are different > > so I believe that all of them are having their own copy of session. > > Further, I am using pool module of sqlalchemy from where a > > connection is returned to orm session. > > > > My guess is that somewhere in that connection management things are > > getting schewed up - > > there was a bug like this at one time in the pool, but it was fixed > probably a year ago, and nobody has reported this issue since. are > the objects which you load from the session being shared between > threads ? i.e. a second thread issues a lazy-load operation on an > object's attribute ? that counts as multi-threaded session access. > > > > > > -- Cheers, - A --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---