# Introducing a PEP 249 compliant transaction behaviour to sqlite3

**URL:** <https://discuss.python.org/t/introducing-a-pep-249-compliant-transaction-behaviour-to-sqlite3/16516>\
**Category:** Core Development\
**Tags:** stdlib\
**Created:** [June 14, 2022, 10:14am UTC](https://discuss.python.org/t/introducing-a-pep-249-compliant-transaction-behaviour-to-sqlite3/16516 "2022-06-14T10:14:17Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![malemburg](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/malemburg/32/50_2.png) [@malemburg](https://discuss.python.org/u/malemburg)\
**Post date:** [June 16, 2022, 10:03am UTC](https://discuss.python.org/t/introducing-a-pep-249-compliant-transaction-behaviour-to-sqlite3/16516/6 "2022-06-16T10:03:29Z")

</div>

Just to confirm, this is the usual meaning of _Connection.autocommit_ (and a draft of what I’ll kick off the process with):

> 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.
> 
> The details around changing the value are database dependent, e.g. changing from `True` to `False` will usually start a new transaction, while changing from `False` to `True` will usually cause the current transaction to be committed. However, it is also possible that a database raises an error in case there are pending changes to be committed. To prevent the latter case, it is best to explicitly commit or rollback the current transaction before switching on autocommit mode on the connection.

It may make sense to have the DB API modules enforce the behavior described as “usual” behavior.

---

_[View the full topic](https://discuss.python.org/t/introducing-a-pep-249-compliant-transaction-behaviour-to-sqlite3/16516)._
