On 01/10/2013 11:41, Tim Golden wrote: > You're sort-of correct. What happens is that the database doesn't enter > autocommit mode (you'll still need to specify the right isolation level > on the .connect for that). Rather, the __exit__ method of the > connection-as-context-manager issues the db.commit() call which will > commit anything outstanding.
Re-reading, we may be using the term "autocommit" in two different ways. I'm using it to refer to a database-internal option where each SQL operation is committed as soon as it completes. This mode of operation is initiated (from Python) by passing an isolation_level of "None" when creating the connection. The "with sqlite3.connect..." approach could be considered a Python-level autocommit where all the operations within the block are committed by virtue of the Python context-manager mechanism which invokes the usual database "COMMIT" operation on exit. In case it helps... TJG _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor