Re: Adding Connection.autocommit as standard extension to DB-API 2.0 (PEP 249)
Erlend Egeberg Aasland <[email protected]> Tue, 1 Nov 2022 14:46:18 +0100
| Newsgroups | gmane.comp.python.db |
|---|---|
| Message-ID | <CAN83Q_snfzc48dOCp+AapThzAteDHsG+vJuQvFK4kFwoHAvdng@mail.gmail.com> |
--===============0018408911403063470== Content-Type: multipart/alternative; boundary="0000000000007af01305ec68f3df" --0000000000007af01305ec68f3df Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 1 Nov 2022 at 14:37, Marc-Andre Lemburg <[email protected]> wrote: > [=E2=80=A6] Instead, I believe we should document what many modules alrea= dy > implement, which is the read/write .autocommit attribute. As for semantic= s, > we should probably go with option 3 and only mention that many modules wi= ll > actually already implement option 2. > +1 Regarding the problem with having attribute write access result in possible > I/O, I think we should at the same time deprecate the write nature of the > .autocommit attribute and announce that it'll be replaced with a newmetho= d, > e.g. .setautocommit() (the DB-API has traditionally not added underscores > to the names, except for the optional TPC API group), for DB-API 3.0. > For the upcoming autocommit attribute of the stdlib sqlite3 module, I wonder if we should stick with these conventions right from the start. That is, autocommit can either be set from the connection constructor (using the new autocommit property), or using a setautocommit() method. The autocommit attribute will be read-only. Related to this, I'd also suggest adding a new keyword parameter to the > connection constructor (autocommit), which defaults to False and can be > used to create autocommit connections right from the start. > +1 Erlend --0000000000007af01305ec68f3df Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div><br></div><div><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gm= ail_attr">On Tue, 1 Nov 2022 at 14:37, Marc-Andre Lemburg <<a href=3D"ma= ilto:[email protected]">[email protected]</a>> wrote:<br></div><blockquote cla= ss=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;= border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)= "> =20 =20 =20 <div> <p dir=3D"auto">[=E2=80=A6] Instead, I believe we should document what = many modules already implement, which is the read/write .autocommit attribute. As for semantics, we should probably go with option 3 and only mention that many modules will actually already implement option 2.</p></div>= </blockquote><div dir=3D"auto">+1</div><div dir=3D"auto"><br></div><blockqu= ote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-wid= th:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,2= 04,204)"><div><p dir=3D"auto"></p> <p dir=3D"auto">Regarding the problem with having attribute write acces= s result in possible I/O, I think we should at the same time deprecate the write nature of the .autocommit attribute and announce that it'll be replaced with a newmethod, e.g. .setautocommit() (the DB-API has traditionally not added underscores to the names, except for the optional TPC API group), for DB-API 3.0.</p></div></blockquote><d= iv dir=3D"auto">For the upcoming autocommit attribute of the stdlib sqlite3= module, I wonder if we should stick with these conventions right from the = start. That is, autocommit can either be set from the connection constructo= r (using the new autocommit property), or using a setautocommit() method. T= he autocommit attribute will be read-only.</div><div dir=3D"auto"><br></div= ><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border= -left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:= rgb(204,204,204)"><div><p dir=3D"auto"></p> <p>Related to this, I'd also suggest adding a new keyword parameter to the connection constructor (autocommit), which defaults to False and can be used to create autocommit connections right from the start.</p></div></blockquote><div dir=3D"auto">+1</div><div dir= =3D"auto"><br></div><div dir=3D"auto"><br></div><div dir=3D"auto">Erlend</d= iv></div></div> --0000000000007af01305ec68f3df-- --===============0018408911403063470== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ DB-SIG maillist - [email protected] https://mail.python.org/mailman/listinfo/db-sig --===============0018408911403063470==--