On 2024-09-09, Lawrence D'Oliveiro wrote:
> On Mon, 9 Sep 2024 10:00:11 - (UTC), Jon Ribbens wrote:
>> On 2024-09-09, Lawrence D'Oliveiro wrote:
>>> The database only needs to commit when it is explicitly told. Anything
>>> less -- no commit.
>>
>> So the Python code is half-way through a tr
On 2024-09-09, Karsten Hilbert wrote:
> Am Mon, Sep 09, 2024 at 10:00:11AM - schrieb Jon Ribbens via Python-list:
>> So the Python code is half-way through a transaction when it throws
>> a (non-database-related) exception and that thread of execution is
>> aborted. The database connection ret
Am Mon, Sep 09, 2024 at 10:00:11AM - schrieb Jon Ribbens via Python-list:
> So the Python code is half-way through a transaction when it throws
> a (non-database-related) exception and that thread of execution is
> aborted. The database connection returns to the pool,
How does it return to th
Am Mon, Sep 09, 2024 at 10:00:11AM - schrieb Jon Ribbens via Python-list:
> > The database only needs to commit when it is explicitly told. Anything
> > less -- no commit.
>
> So the Python code is half-way through a transaction when it throws
> a (non-database-related) exception and that thre
On 2024-09-08, Lawrence D'Oliveiro wrote:
> On Sun, 8 Sep 2024 11:03:21 - (UTC), Jon Ribbens wrote:
>> What if there's an exception in your exception handler? I'd put the
>> rollback in the 'finally' handler, so it's always called. If you've
>> already called 'commit' then the rollback does no
On 2024-09-09, Lawrence D'Oliveiro wrote:
> On Mon, 9 Sep 2024 09:13:40 - (UTC), Jon Ribbens wrote:
>> On 2024-09-08, Lawrence D'Oliveiro wrote:
>>> On Sun, 8 Sep 2024 11:03:21 - (UTC), Jon Ribbens wrote:
What if there's an exception in your exception handler? I'd put the
rollba
On 2024-09-08, Greg Ewing wrote:
> On 8/09/24 9:20 am, Karsten Hilbert wrote:
>> try:
>> do something
>> except:
>> log something
>> finally:
>> .commit()
>>
>> cadence is fairly Pythonic and elegant in that it ensures the
>> the .commit() wil
Am Mon, Sep 09, 2024 at 01:48:32PM +1200 schrieb Greg Ewing via Python-list:
> That code doesn't inspire much confidence in me. It's far too
> convoluted with too much micro-management of exceptions.
It is catching two exceptions, re-raising both of them,
except for re-raising one of them as anot
Am Mon, Sep 09, 2024 at 01:48:32PM +1200 schrieb Greg Ewing via Python-list:
> That code doesn't inspire much confidence in me. It's far too
> convoluted with too much micro-management of exceptions.
>
> I would much prefer to have just *one* place where exceptions are
> caught and logged.
I am o