
On 03-10-2006 13:59:16 +0200, Ronald Oussoren wrote:
Something completely different: how do I coax the python DB-API implementation out of autocommit mode?
import MonetSQLdb conn = MonetSQLdb.connect() cursor = conn.cursor() conn.commit() # -> raises RuntimeError
Any updates you do through 'conn' are also instantationious, e.g. no transactions. I can use the 'START TRANSACTION' query to explictly start a transaction, but I then have to keep track of whether I've used 'START TRANSACTION' on one of the active cursors because executing START TRANSACTION inside a transaction seems to break that transaction.
The effect I'm looking after is that of the interactive MapiClient when autocommit is disabled: you don't have to start transactions explicitly but are always in one.
Isn't there a conn.setAutoCommit() or something? Switching off auto-commit, is done through a control command Xautocommit 0 (or 1 to enable it again). It is different from START TRANSACTION in that sense that upon a COMMIT the auto-commit is retained (switched off).