On Monday, January 23, 2017 at 1:26:08 PM UTC-5, Michael Merickel wrote:
>
> The best resource I know is 
> http://zodb.readthedocs.io/en/latest/transactions.html along with staring 
> at various implementations of data managers. A good one to look at would be 
> zope.sqlalchemy which is the data manager implementation for sqlalchemy 
> sessions. There is also repoze.sendmail with a fairly tricky one for 
> sending emails.
>

The zope.sqlalchemy is the gold standard, I would just focus on that.  It 
handles the two-phase and savepoints perfectly.   I ported the savepoints 
from it to repoze.sendmail years ago, and there are still edge-cases 
popping up on it.


Other than that, you can actually get really far by just using 
> `tm.addAfterCommitHook()` to do the work after a successful commit. For 
> example, if writing to elasticsearch is not mission critical you could use 
> the hook, allow it to fail but still commit data to your rdbms, and have a 
> background job sync the failed attempt later.
>

Another reason to focus on zope.sqlalchemy is that a lot of Python 
transaction plugins would be better off written to addAfterCommitHook. 
 Many of the plugins out there basically implement this in a fancy way - 
they silently fail on errors and/or the service they control doesn't offer 
a two-phase commit that can roll back.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/2c27ff76-03ff-4a18-9759-95cbfbb2594c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to