| Deutsch English Français Italiano |
|
<vbnnuu$2i1cc$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder9.news.weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Lawrence D'Oliveiro <ldo@nz.invalid> Newsgroups: comp.lang.python Subject: Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited) Date: Mon, 9 Sep 2024 21:05:34 -0000 (UTC) Organization: A noiseless patient Spider Lines: 18 Message-ID: <vbnnuu$2i1cc$1@dont-email.me> References: <Ztx1sZMGTnA3eLP1@hermes.hilbert.loc> <7cb50df2-9c76-477f-91c9-e149c7637104@aklaver.com> <ZtytJMhyvtExPxfF@hermes.hilbert.loc> <5ee80b84-f04b-454d-ab39-45572e0751a1@aklaver.com> <Zty7ZCMwKQl4C4Id@hermes.hilbert.loc> <4a1b12fc-24b7-4c7e-b1f2-6ec9c5f341c2@aklaver.com> <ZtzDubguRDWXwV-t@hermes.hilbert.loc> <mailman.46.1725744071.2917.python-list@python.org> <lk4ajkFbbnrU1@mid.individual.net> <slrnvdr13p.4dt.jon+usenet@raven.unequivocal.eu> <vbl2ig$222n3$2@dont-email.me> <slrnvdtf24.4dt.jon+usenet@raven.unequivocal.eu> <vbmge5$2c7jr$1@dont-email.me> <slrnvdthpa.4dt.jon+usenet@raven.unequivocal.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Mon, 09 Sep 2024 23:05:35 +0200 (CEST) Injection-Info: dont-email.me; posting-host="48619980776be9ad3edbc43d1fdbfd55"; logging-data="2688396"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/sdx9C0ad3HDuaWAzm5Z7c" User-Agent: Pan/0.160 (Toresk; ) Cancel-Lock: sha1:vNYiAfKv99H0CIGEt4veMzZPRtw= Bytes: 2473 On Mon, 9 Sep 2024 10:00:11 -0000 (UTC), Jon Ribbens wrote: > On 2024-09-09, Lawrence D'Oliveiro <ldo@nz.invalid> 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 transaction when it throws a > (non-database-related) exception and that thread of execution is > aborted. The database connection returns to the pool ... The DBMS connection is deleted. The DBMS discards all context created for this connection, including any transactions in progress. Gone. The database structures on persistent storage are also carefully designed with transaction safety in mind. So any partial transaction data saved on persistent storage that remains after a system crash can be identified as such and discarded, leaving the database in its pre-transaction state.