On Wed, Dec 28, 2011 at 3:19 PM, Michael Bayer <[email protected]>wrote:
> > On Dec 28, 2011, at 3:28 PM, Mike Orr wrote: > > > > >> I would think if the plugin is designed for Pyramid, it would be based > around ZopeSQLAlchemy, which provides a master transaction for everyone to > integrate towards. Do the third party plugins at least integrate with that > ? > > > > Question: if multiple scoped sessions are created, each using > > ZopeTransactionExtension, would they all automatically fit into the > > global commit/rollback? > > > > Can we use the same ZopeTransactionExtension *instance* for all the > > scoped sessions, or would they each need a separate instance? > > yeah I'd like to get guidance from Chris McD or Lawrence Rowe on what a > multiple-session integration path might be (or if all apps should really > use one Session with zope.sqlalchemy). also my apologies for screwing up > it's name. Sorry, I'm not Chris or Lawrence, but I can tell you that the "transaction" package, which the ZTE and many other transaction-aware packages support, utilizes a threadlocal manager to which each ZopeTransactionExtension (ZTE) instance joins. The short answer is that if you have multiple ScopedSession objects that are using the ZTE, they will all be controlled by the same global transaction, and when pyramid_tm does transaction.commit() all of the sessions that are marked dirty will be committed. The ZTE supports two-phase transactions, but only if the ScopedSession is initialized with "twophase=True", thus ideally all sessions are done this way: DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension(), twophase=True)) -- You received this message because you are subscribed to the Google Groups "pylons-discuss" 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/pylons-discuss?hl=en.
