Ok that makes sense. Thank you Mike.
On Jun 16, 10:42 pm, Michael Merickel <[email protected]> wrote: > On Thu, Jun 16, 2011 at 12:38 AM, Liju <[email protected]> wrote: > > The documentation says 'It’s sometimes advantageous to not use > > SQLAlchemy’s thread-scoped sessions'. > > The issue isn't with scoped_session as much as it has to do with using a > global variable to store your database connections. It just works out that > if you avoid using a global variable, you don't need the protection of > scoped_sessions because everything in pyramid is per-request (which is > per-thread) already. > > The reasons to avoid using a global scoped_session are the same as the > reasons to avoid any global variable. It's true that each request is > processed in a separate thread (or greenlet as the case may be). However, > that doesn't address the issue of running multiple applications in the same > process. All of a sudden your global variables start stepping on each other > and you have problems. Obviously this is not a common case, but the fact > that pyramid has no global variables, and that there are ways to avoid > creating any in your app as well, can really save your butt when the time > comes. > > -- > > Michael -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
