Re: psycopg2: proper positioning of .commit() within try: except: blocks - Mailing list psycopg

From Adrian Klaver
Subject Re: psycopg2: proper positioning of .commit() within try: except: blocks
Date
Msg-id 4a1b12fc-24b7-4c7e-b1f2-6ec9c5f341c2@aklaver.com
Whole thread Raw
In response to Re: psycopg2: proper positioning of .commit() within try: except: blocks  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
Responses Re: psycopg2: proper positioning of .commit() within try: except: blocks
List psycopg
On 9/7/24 13:45, Karsten Hilbert wrote:
> Am Sat, Sep 07, 2024 at 01:03:34PM -0700 schrieb Adrian Klaver:
> 
>> In the case you show you are doing commit() before the close() so any errors in the
>> transactions will show up then. My first thought would be to wrap the commit() in a
>> try/except and deal with error there.
> 
> Right, and this was suggested elsewhere ;)
> 
> And, yeah, the actual code is much more involved :-D
> 

I see that.

The question is does the full code you show fail?

The code sample you show in your original post is doing something very 
different then what you show in your latest post. At this point I do not 
understand the exact problem we are dealing with.


> 
> 
> Best,
> Karsten
> --
> GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B

-- 
Adrian Klaver
adrian.klaver@aklaver.com




psycopg by date:

Previous
From: Karsten Hilbert
Date:
Subject: Re: psycopg2: proper positioning of .commit() within try: except: blocks
Next
From: Karsten Hilbert
Date:
Subject: Re: psycopg2: proper positioning of .commit() within try: except: blocks