[Tutor] sqlite3 COMMIT directive

Oscar Benjamin oscar.j.benjamin at gmail.com
Wed Oct 2 11:14:13 CEST 2013


On 1 October 2013 12:05, Alan Gauld <alan.gauld at btinternet.com> wrote:
>
> OK, That makes sense it's a bit like the file close at the end of a with
> block. So the docs statement that it automatically commits *transactions* is
> slightly misleading as it only commits the full content of the block which
> could hold multiple transactions.

In the light of this confusion the docs do seem ambiguous. However I
learned to use sqlite3 through those docs and always understood that
the context manager was for committing or rolling back all
transactions within the "with" block. It's actually very useful and a
good use of a context manager (enabling auto-commit would also be
useful but it doesn't really need a context manager).


Oscar


More information about the Tutor mailing list