Re: Adding Connection.autocommit as standard extension to DB-API 2.0 (PEP 249)

"Mike Bayer" <[email protected]> Fri, 28 Oct 2022 12:36:05 -0400
Newsgroups gmane.comp.python.db
Message-ID <[email protected]>
--===============2570738601223379929==
Content-Type: multipart/alternative;
 boundary=43c4f2982ef24fddb7b4ed1310e24bf9

--43c4f2982ef24fddb7b4ed1310e24bf9
Content-Type: text/plain



On Fri, Oct 28, 2022, at 12:14 PM, Marc-Andre Lemburg wrote:
> 
> Overall, I believe that important settings such as autocommit
> should only be set in the connection constructor, since the
> semantics change dramatically between autocommit and manual
> commit.

oh, that change would be much more intrusive.   This defeats the usability of connection pools, and being able to reset session state on a connection so that it may be returned to a pool for re-use is a normal thing.  Within the MS ODBC realm Ive just learned of the sp_reset_connection stored procedure, which seems to be sparsely documented, but is mentioned as essential for pooling here:  
https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/using-integrated-authentication?view=sql-server-ver16#tracking-access-to-a-database





> 
> In such a world, we'd only have an autocommit keyword argument
> in the Connection constructor and a read-only attribute on the
> object to query this after creation.
> 
> Such a change could be implemented for a DB-API 3.0. For 2.0,
> the ship has sailed already.
> 
> So how about going with the above compromise (*) ?
> 
> -- 
> Marc-Andre Lemburg
> eGenix.com
> 
> Professional Python Services directly from the Experts (#1, Oct 28 2022)
> >>> Python Projects, Coaching and Support ...    https://www.egenix.com/
> >>> Python Product Development ...        https://consulting.egenix.com/
> ________________________________________________________________________
> 
> ::: We implement business ideas - efficiently in both time and costs :::
> 
>     eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
>      D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
>             Registered at Amtsgericht Duesseldorf: HRB 46611
>                 https://www.egenix.com/company/contact/
>                       https://www.malemburg.com/
> 
> 

--43c4f2982ef24fddb7b4ed1310e24bf9
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html><html><head><title></title><style type=3D"text/css">p.Mso=
Normal,p.MsoNoSpacing{margin:0}</style></head><body><div><br></div><div>=
<br></div><div>On Fri, Oct 28, 2022, at 12:14 PM, Marc-Andre Lemburg wro=
te:<br></div><blockquote type=3D"cite" id=3D"qt" style=3D""><div><br></d=
iv><div>Overall, I believe that important settings such as autocommit<br=
></div><div>should only be set in the connection constructor, since the<=
br></div><div>semantics change dramatically between autocommit and manua=
l<br></div><div>commit.<br></div></blockquote><div><br></div><div>oh, th=
at change would be much more intrusive.&nbsp;&nbsp; This defeats the usa=
bility of connection pools, and being able to reset session state on a c=
onnection so that it may be returned to a pool for re-use is a normal th=
ing.&nbsp; Within the MS ODBC realm Ive just learned of the sp_reset_con=
nection stored procedure, which seems to be sparsely documented, but is =
mentioned as essential for pooling here:&nbsp; <br></div><div><a href=3D=
"https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/using-inte=
grated-authentication?view=3Dsql-server-ver16#tracking-access-to-a-datab=
ase">https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/using-=
integrated-authentication?view=3Dsql-server-ver16#tracking-access-to-a-d=
atabase</a><br></div><div><br></div><div><br></div><div><br></div><div><=
br></div><div><br></div><blockquote type=3D"cite" id=3D"qt" style=3D""><=
div><br></div><div>In such a world, we'd only have an autocommit keyword=
 argument<br></div><div>in the Connection constructor and a read-only at=
tribute on the<br></div><div>object to query this after creation.<br></d=
iv><div><br></div><div>Such a change could be implemented for a DB-API 3=
.0. For 2.0,<br></div><div>the ship has sailed already.<br></div><div><b=
r></div><div>So how about going with the above compromise (*) ?<br></div=
><div><br></div><div>--&nbsp;<br></div><div>Marc-Andre Lemburg<br></div>=
<div>eGenix.com<br></div><div><br></div><div>Professional Python Service=
s directly from the Experts (#1, Oct 28 2022)<br></div><div>&gt;&gt;&gt;=
 Python Projects, Coaching and Support ...&nbsp;&nbsp;&nbsp;&nbsp;<a hre=
f=3D"https://www.egenix.com/">https://www.egenix.com/</a><br></div><div>=
&gt;&gt;&gt; Python Product Development ...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;<a href=3D"https://consulting.egenix.com/">https://co=
nsulting.egenix.com/</a><br></div><div>_________________________________=
_______________________________________<br></div><div><br></div><div>:::=
 We implement business ideas - efficiently in both time and costs :::<br=
></div><div><br></div><div>&nbsp;&nbsp;&nbsp; eGenix.com Software, Skill=
s and Services GmbH&nbsp; Pastor-Loeh-Str.48<br></div><div>&nbsp;&nbsp;&=
nbsp;&nbsp; D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemb=
urg<br></div><div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp; Registered at Amtsgericht Duesseldorf: HRB 46611<br></div><=
div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=3D"https://www.egenix.com/company/co=
ntact/">https://www.egenix.com/company/contact/</a><br></div><div>&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=3D"https:/=
/www.malemburg.com/">https://www.malemburg.com/</a><br></div><div><br></=
div><div><br></div></blockquote><div><br></div></body></html>
--43c4f2982ef24fddb7b4ed1310e24bf9--

--===============2570738601223379929==
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

--===============2570738601223379929==--