On Wed, 2011-06-15 at 22:38 -0700, Liju wrote: > The documentation says 'It’s sometimes advantageous to not use > SQLAlchemy’s thread-scoped sessions'. Thread-scoped as I understand is > done using scoped_session(), which will associate an SQLAlchemy > session for currently running thread. > > WIth my experience from J2EE I understand that each request-response > is a separate thread, and assume thats the same for Pyramid ? If this > is true, whats the benefit of associating a new session in a custom > request object as in the documentation ? > > http://docs.pylonsproject.org/projects/pyramid_cookbook/dev/sqla.html#using-a-non-global-session > > I dont see a difference. Can someone please explain the difference ? > and which option to use when (with an example).
I'd just used scoped_session(), as most other folks do already, and seem to not be bothered by the fact that it uses thread local variables. If thread local variables bother you, you can avoid their use by following the instructions in that link. If you dont care, don't bother. There is no appreciable performance benefit to using one or the other. - C -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.