@classmethod
def begin(cls):
    """
        Initialize a thread-local transaction. An exception is raised if
        there's already a pending transaction.
        """
    if cls.app.local.sqla_tx is not None:
        raise Exception('there is already an open transaction')
    cls.app.local.sqla_tx = cls.app.local.sqla_conn.begin()
