Re: psycopg3 transactions

Поиск
Список
Период
Сортировка
От Karsten Hilbert
Тема Re: psycopg3 transactions
Дата
Msg-id YWtWyC/Ur+iqHTLv@hermes.hilbert.loc
обсуждение исходный текст
Ответ на Re: psycopg3 transactions  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Ответы Re: psycopg3 transactions  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
Re: psycopg3 transactions  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Список psycopg
> I have expanded the documentation about transaction behaviour.
> Feedback is welcome.
>
> 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 agree

that writing to files seems similar, and is persistent by
default, but then files don't sport transaction semantics.

I also agree

that a transaction being started by the first SQL command can
be surprising to newcomers. It could be explained away by
stating "once you start doing something to the database you
*are* inside a transaction -- unless you have taken very
specific action not to be" very prominently in the docs.

However,

the fact that "plain" use of psycopg3 and context manager use
of psycopg3 yields opposite behaviour (default-rollback vs
default-commit) seems to violate the Principle Of Least
Astonishment ?

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



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

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