On Jan 7, 2013, at 7:20 PM, Diego Woitasen wrote: > > I'm back to this :) > > My problem was that I'm not closing the session properly. > > My new question is... is there a way to autoclose the session? My example, at > the end of the scope? > > What's the recommend way to do this? > > I've read the FAQ, but it's not very clear for me.
you need to structure your application such that database operations occur within a consistent framework. This is the simplest when using web frameworks, as all frameworks include some kind of " request end" hook - that's where the close of the Session would go. Looking at your example again, I see you have a "print delivery.name, delivery.status" after you've done your commit(). That would be a likely source for the new connection here, as accessing those attributes means the Session needs to go back to the database post-commit to get their most recent value. -- 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.