I'm not sure if there is a need for context support at the moment. Almost all databases automatically rollback transactions if they are not committed before a connection is closed. In the pyodbc connection finalizer, I automatically issue a rollback if a commit didn't occur.
Since CPython uses reference counting (and will for the foreseeable future), this allows you to just use the following: def function(): cnxn = get_connection() cursor = connection.cursor() cursor.execute("update ...") cursor.execute("delete from ...") cursor.commit() If an exception is raised before the commit, everything is rolled back. +0 Michael Kleehammer pyodbc maintainer http://pyodbc.sourceforge.net _______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig