Re: [psycopg] Nested transactions support for code composability - Mailing list psycopg

From Jonathan Rogers
Subject Re: [psycopg] Nested transactions support for code composability
Date
Msg-id 88f1789c-6b11-162e-16ce-21efea209655@emphasys-software.com
Whole thread Raw
In response to Re: [psycopg] Nested transactions support for code composability  (Christophe Pettus <xof@thebuild.com>)
List psycopg
On 01/22/2017 12:22 PM, Christophe Pettus wrote:
>
>> On Jan 22, 2017, at 08:49, Daniel Fortunov <psycopg-list@danielfortunov.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
usesome kind of framework (SQL Alchemy, Django) that mediates between the database and application.  Thus, adding this
kindof "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@emphasys-software.com


Attachment

psycopg by date:

Previous
From: Christophe Pettus
Date:
Subject: Re: [psycopg] Nested transactions support for code composability
Next
From: Aryeh Leib Taurog
Date:
Subject: Re: [psycopg] speed concerns with executemany()