Re: Nested transactions support for code composability

From: Christophe Pettus <xof(at)thebuild(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Daniel Fortunov <psycopg-list(at)danielfortunov(dot)com>, psycopg(at)postgresql(dot)org
Subject: Re: Nested transactions support for code composability
Date: 2017-01-22 18:08:38
Message-ID: 2254562A-20C1-4A4E-86E2-2E7CB6FC3BAD@thebuild.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg


> On Jan 22, 2017, at 09:57, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> wrote:
>
> I have not used nested transaction outside of Django's implementation of @xact() eg @atomic(). Still a little fooling around with psycopg2 code led to this:

It would be pretty straight-forward (although I haven't done it) to do a non-Django version of xact(); you'd probably just pass the connection object in as a parameter to the decorator.

I've noticed that in real life the savepoint functionality is not used all that much, but it does provide a nice consistency to the implied semantics of the decorator, and it's great when you actually do need it.
--
-- Christophe Pettus
xof(at)thebuild(dot)com

In response to

Browse psycopg by date

  From Date Subject
Next Message Jonathan Rogers 2017-01-23 16:45:41 Re: Nested transactions support for code composability
Previous Message Adrian Klaver 2017-01-22 17:57:23 Re: Nested transactions support for code composability