-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 12/14/2014 05:23 AM, Wolfgang Schnerring wrote:
> * Mikko Ohtamaa <
mi...@redinnovation.com> [2014-12-12 21:21]:
>> Not sure if this the right list to ask for regarding
>> zope.sqlalchemy and transaction the package, so please point me to
>> the right direction.
>
> I think this discussion should move to the Pyramid folks[1].
>
>> I am looking to have clarifications for the role of transaction
>> package and zope.sqlalchemy packages in the context of SQLAlchemy
>> project.
>
> The very short answer is: the `transaction`[2] package is an
> *abstract* implementation of the (two-phase) commit protocol[3]. This
> allows web frameworks like Pyramid (which most often employs
> `pyramid_tm`[4] to do that) to offer transaction management
> regardless of the actual database being used (be it relational like
> postgres, or ZODB, or CouchDB, or...). Of course, since `transaction`
> is abstract, you need a concrete backend implementation for the
> database(s) you want to use with it. ZODB for example has
> `transaction` integration built in, while `zope.sqlalchemy` is an
> adapter that hooks `sqlalchemy` into the `transaction` machinery.
The rest of the picture is that pyramid_tm[1] (or repoze.tm2[2], for
non-Pyramid WSGI apps) arranges to begin a transaction at the start of
every request, and to commit the transaction (if the application returns
normally) or abort it (if the application raises an error).
pyramid_tm also has support for retrying request which raise certain
kinds of database-related exceptions (ZODB's ConflictErrorr, etc.: see
http://docs.pylonsproject.org/projects/pyramid-tm/en/latest/#retrying).
For non-Pyramid WSGI apps, repoze.retry[3] does the same.
The key point is that application code in these environments no longer
needs to concern itself with the transaction in the vast majority of
cases: it just needs to raise the appropriate exception, or return a
normal response.
> Side note: Thank you for asking about this. Unfortunately,
> documentation, especially on the conceptual level, for Zope/ZTK,
> ZODB, and related packages is close to nonexistent at this time.
Carlos de la Guardia's ZODB book[4] should be helpful.
[1]
http://docs.pylonsproject.org/projects/pyramid-tm/en/latest/
[2]
http://docs.repoze.org/tm2
[3]
http://docs.repoze.org/retry
[4]
http://www.zodb.org/en/latest/documentation/guide/index.html
- --
===================================================================
Tres Seaver
+1 540-429-0999 tse...@palladion.com
Palladion Software "Excellence by Design"
http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
iEYEARECAAYFAlSNj7IACgkQ+gerLs4ltQ6ujACdG9r/WgOfLhmnxKefIzh/Lj4D
EacAnidQboGkwXhyU1183HLS2FolPDdL
=i3gS
-----END PGP SIGNATURE-----