On Sun, Mar 28, 2010 at 10:19 AM, Peteris Krumins <[email protected]> wrote:
> This is the best explanation I have read on this topic! Thanks for > writing it! Now I clearly see what is going on. > > Just one more thing - when should remove() be called? (if at all) The model that works for me is as follows: 1) use scoped_session() which will give every function in your Web app the same session when they call session = Session() locally. 2) If you have a long-running process that handles more than one HTTP request, only close() or remove() the session once, at the end of the HTTP request (generally, it's a good idea to add this to a finish() method for the HTTP request handler or something so it is done automatically.) This will ensure that each request gets a new, fresh session. Regards, Daniel -- You received this message because you are subscribed to the Google Groups "sqlalchemy" 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/sqlalchemy?hl=en.
