@contextmanager<EOL><INDENT>def transaction(self):<DEDENT>
conn = self.get_connection()<EOL>tx = conn.transaction()<EOL>try:<EOL><INDENT>yield conn<EOL>tx.commit()<EOL><DEDENT>except:<EOL><INDENT>tx.rollback()<EOL><DEDENT>finally:<EOL><INDENT>conn.close()<EOL><DEDENT>
A context manager for executing a transaction on this Database.