Re: psycopg3 transactions

Поиск
Список
Период
Сортировка
От Karsten Hilbert
Тема Re: psycopg3 transactions
Дата
Msg-id YWtZKL1nVM/KV5S7@hermes.hilbert.loc
обсуждение исходный текст
Ответ на Re: psycopg3 transactions  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
Ответы Re: psycopg3 transactions  (Magnus Hagander <magnus@hagander.net>)
Список psycopg
Am Sun, Oct 17, 2021 at 12:48:40AM +0200 schrieb Karsten Hilbert:

> > https://www.psycopg.org/psycopg3/docs/basic/transactions.html
>
> I am sorry to say this but this concept:
>
>     This way we don’t have to remember to call neither
>     close() nor commit() and the database operation have
>     actually a persistent effect.
>
> seems fundamentally flawed to me in terms of databases.
> Actually changing the content of a database should be a
> conscious decision by program(mer) logic.

I could, perhaps, agree with the *transaction* context
manager being default-commit because:

    - after the context block the transaction has gone away

    - hence what happens inside either failed (auto-rollback)

    - or is to be committed

Not so for the *connection* context manager.

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



В списке psycopg по дате отправления:

Предыдущее
От: Karsten Hilbert
Дата:
Сообщение: Re: psycopg3 transactions
Следующее
От: Magnus Hagander
Дата:
Сообщение: Re: psycopg3 transactions