Re: Nested transactions support for code composability

From: Christophe Pettus <xof(at)thebuild(dot)com>
To: Daniel Fortunov <psycopg-list(at)danielfortunov(dot)com>
Cc: psycopg(at)postgresql(dot)org
Subject: Re: Nested transactions support for code composability
Date: 2017-01-16 23:29:53
Message-ID: 2C0DAD9D-A5AF-4E66-9A79-6DD5C49F7657@thebuild.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg


> On Jan 16, 2017, at 15:26, Daniel Fortunov <psycopg-list(at)danielfortunov(dot)com> wrote:
>
> I'd like to implement support for nested transactions in psycopg2 using a context manager that internally uses postgres savepoints to implement the ability to nest transactions within each other, with sensible commit and rollback semantics.

You can see two existing examples of this, based on Django. Django implements the @atomic() decorator, which was based on my @xact() decorator:

https://github.com/Xof/xact

They can almost certainly be eased out of the Django infrastructure easily enough!

--
-- Christophe Pettus
xof(at)thebuild(dot)com

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Wes McKinney 2017-01-17 01:20:48 Re: Turbo ODBC
Previous Message Daniel Fortunov 2017-01-16 23:26:59 Nested transactions support for code composability