On Apr 5, 2009, at 3:34 PM, Diez B. Roggisch wrote:
> > Michael Bayer schrieb: >> the close() will remove any objects left in the session and may >> help with >> unit tests in that the subsequent tests aren't interfered with by >> objects >> remaining from the previous test. > > Where is the difference between a process running several tests and > one > answering several http requests via mod_wsgi? > > The code to set up the session is this: > > DBSession = scoped_session(sessionmaker( > autoflush=True, > autocommit=False, > )) > > Then code running DB-stuff is wrapped into begin/(commit/rollback) > via a > decorator. This is the same for my tests as well as the production > system. > > So if the close() is needed for tests, I presume it's needed for the > production code as well? not at all, when you commit/rollback, everything in the session is expired (assuming you're on 0.5). Doing a remove() at the end of a request is a good way to ensure nothing is around from the previous request but in theory its not needed. But again, I've no idea what TG does in this regard. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---