Re: Nested transactions support for code composability

From: Jonathan Rogers <jrogers(at)emphasys-software(dot)com>
To: <psycopg(at)postgresql(dot)org>
Subject: Re: Nested transactions support for code composability
Date: 2017-01-23 16:45:41
Message-ID: 88f1789c-6b11-162e-16ce-21efea209655@emphasys-software.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On 01/22/2017 12:22 PM, Christophe Pettus wrote:
>
>> On Jan 22, 2017, at 08:49, Daniel Fortunov <psycopg-list(at)danielfortunov(dot)com> wrote:
>> So what am I missing? Doesn't anyone find the need for this outside of Django?!
>
> Mostly, it's that relatively few people use raw psycopg2 for database access in substantial applications; they all use some kind of framework (SQL Alchemy, Django) that mediates between the database and application. Thus, adding this kind of "nested" transaction support has to be done in concert with the framework.
>
> It for sure can be done outside of any framework; there's nothing all that Django specific about xact(), in particular.
> --

I implemented nested transactions in a custom psycopg2 wrapper. Later, I
discovered that SQLAlchemy also has nested transactions. It's simple
enough to implement that it's probably been done many times.

--
Jonathan Rogers
Socialserve.com by Emphasys Software
jrogers(at)emphasys-software(dot)com

In response to

Browse psycopg by date

  From Date Subject
Next Message Aryeh Leib Taurog 2017-01-29 17:44:10 Re: speed concerns with executemany()
Previous Message Christophe Pettus 2017-01-22 18:08:38 Re: Nested transactions support for code composability