Deutsch English Français Italiano |
<vbl2ig$222n3$2@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!3.eu.feeder.erje.net!feeder.erje.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: Sun, 8 Sep 2024 20:48:16 -0000 (UTC) Organization: A noiseless patient Spider Lines: 11 Message-ID: <vbl2ig$222n3$2@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> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Sun, 08 Sep 2024 22:48:17 +0200 (CEST) Injection-Info: dont-email.me; posting-host="5b47ecd330ac087ccb2ea7289cdcbed3"; logging-data="2165475"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18zl6tvvQVHv2hvyCVSum/k" User-Agent: Pan/0.160 (Toresk; ) Cancel-Lock: sha1:ywOOkYPPC9sIqp1/0lYTiZbXN5g= Bytes: 1909 On Sun, 8 Sep 2024 11:03:21 -0000 (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 nothing of course. In any DBMS worth its salt, rollback is something that happens automatically if the transaction should fail to complete for any reason. This applies for any failure reason, up to and including a program or system crash.