'Execute a statement + params on the given cursor.
Adds appropriate logging and exception handling.
This method is used by DefaultDialect for special-case
executions, such as for sequences and column defaults.
The path of statement execution in the majority of cases
terminates at _execute_context().'

def _cursor_execute(self, cursor, statement, parameters, context=None):

    if (self._has_events or self.engine._has_events):
        for fn in self.dispatch.before_cursor_execute:
            (statement, parameters) = fn(self, cursor, statement, parameters, context, False)
    if self._echo:
        self.engine.logger.info(statement)
        self.engine.logger.info('%r', parameters)
    try:
        for fn in (() if (not self.dialect._has_events) else self.dialect.dispatch.do_execute):
            if fn(cursor, statement, parameters, context):
                break
        else:
            self.dialect.do_execute(cursor, statement, parameters, context)
    except Exception as e:
        self._handle_dbapi_exception(e, statement, parameters, cursor, context)
    if (self._has_events or self.engine._has_events):
        self.dispatch.after_cursor_execute(self, cursor, statement, parameters, context, False)
