Re: Adding Connection.autocommit as standard extension to DB-API 2.0 (PEP 249)
Marc-Andre Lemburg <[email protected]> Mon, 14 Nov 2022 14:23:48 +0100
| Newsgroups | gmane.comp.python.db |
|---|---|
| Organization | eGenix.com Software GmbH; http://www.egenix.com/ |
| Message-ID | <[email protected]> |
Here's the updated wording for the addition, which should cover
everything we have discussed:
"""
Connection.autocommit
Attribute to query and set the autocommit mode of the connection.
Returns True if the connection is operating in autocommit (non-
transactional) mode. Returns False is the connection is operating in
manual commit (transactional) mode.
Setting the attribute to True or False adjusts the connection's mode
accordingly.
Changing the setting from True to False (disabling autocommit) will
have the database leave autocommit mode and starts a new transaction.
Changing from False to True (enabling autocommit) has database
dependent semantics with respect to how pending transactions are
handled [1].
Deprecation notice: Even though several database modules implement
both the read and write nature of this attribute, setting the
autocommit mode by writing to the attribute is deprecated, since this
may result in I/O and related exceptions, making it difficult to
implement in an async context [2].
[1] Many database modules implementing the autocommit attribute will
automatically commit any pending transaction and then enter autocommit
mode.
[2] For DB-API 3.0, we are going to introduce a new method
.setautocommit(value), which will allow setting the autocommit mode, and
make .autocommit a read-only attribute. Additionally, we are considering
to add a new standard keyword parameter autocommit to the Connection
constructor. Modules authors are encouraged to add these changes in
preparation for this change.
"""
Please let me know whether I forgot anything. I'll prepare the PR
for PEP 249 later this week.
Thanks,
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Experts (#1, Nov 14 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/
_______________________________________________
DB-SIG maillist - [email protected]
https://mail.python.org/mailman/listinfo/db-sig