'Executes the given SQL statement, with optional parameters.
If the instance\'s debug attribute is True, prints out what it executes.'

def execute(self, sql, params=[], print_all_errors=True):

    self._possibly_initialise()
    cursor = self._get_connection().cursor()
    if self.debug:
        print(('            =    %s' % sql), params)
    if self.dry_run:
        return []
    get_logger().debug(text_type(('execute    "%s"    with    params    "%s"' % (sql, params))))
    try:
        cursor.execute(sql, params)
    except DatabaseError as e:
        if print_all_errors:
            self._print_sql_error(e, sql, params)
        raise
    try:
        return cursor.fetchall()
    except:
        return []
