Transactions

cTDS utilizes the IMPLICIT_TRANSACTIONS feature of Microsoft SQL Server for transaction management. This approach was chosen given the similarities to the DB API 2.0 specification . The spec implies that transactions are implicitly created, but must be explicitly committed, using the ctds.Connection.commit() method, or rolled back, using the ctds.Connection.rollback() method.

cTDS supports disabling of the use of IMPLICIT_TRANSACTIONS if desired. In this case the ctds.Connection.commit() and ctds.Connection.rollback() methods have no affect and transactions are implicitly commited after each call to ctds.Cursor.execute(), ctds.Cursor.executemany() or ctds.Cursor.callproc().

Autocommit

The autocommit parameter to ctds.connect() and ctds.Connection.autocommit controls the use of IMPLICIT_TRANSACTIONS. When True, transactions are implicitly committed after an operation and calls to ctds.Connection.commit() are unnecessary (IMPLICIT_TRANSACTIONS is set to OFF).