On Nov 29, 2011, at 8:30 PM, Geo wrote:
> I'm not sure if my code has closed the session, the context is: > > import transaction > x_members = session.query(Distributor).join.... > > try: > transaction.begin() > for member in x_members: > ..... > except: > transaction.abort() > BTW, I'm using pyramid framework, which is using the following statement to > init the session: > DBSession = scoped_session(sessionmaker( > extension=ZopeTransactionExtension())) > > It's likely you're starting with a new Session when begin() is called, but this depends on the workings of ZopeTransactionExtension and I'd ask on their list about it. You shouldn't have any calls to begin/abort/try/except when using Pyramid though, all of that should be happening behind the scenes. A framework isn't worth much if you need to be hand-coding defensive transaction blocks in application code. -- 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.