Or, you can create your mapped objects per request, yes, or perhaps
per thread.

>> how much can this cost in terms of performance ?

On 7/20/07, Michael Bayer <[EMAIL PROTECTED]> wrote:
>
>
>
> On Jul 19, 2007, at 4:39 PM, Arun Kumar PG wrote:
>
> >
> > Will this be a problem even if I attach a new session per incoming
> > request i.e. thread handling request ? So basically it's because of
> > having the same copy of mapped objects ? How can I solve the above
> > problem in existing way without using a QueuePool ? By creating
> > mapped objects per request ?
>
> the objects that were loaded within a particular session stay there
> until you remove them.  therefore, whatever session you are using to
> load the objects, you should dispose of before putting the objects
> into a thread-global scope (you can call clear() on it to empty it
> out).  Also, you probably want to load all of their related items
> either explicitly or through eager loading - since when the objects
> are detached, the lazy loaders will raise errors when called.
>
> Or, you can create your mapped objects per request, yes, or perhaps
> per thread.
>
>
>
> >
>


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

Reply via email to