def execute_sql(self, result_type=MULTI):
    "\n        Run the query against the database and returns the result(s). The\n        return value is a single data item if result_type is SINGLE, or an\n        iterator over the results if the result_type is MULTI.\n\n        result_type is either MULTI (use fetchmany() to retrieve all rows),\n        SINGLE (only retrieve a single row), or None. In this last case, the\n        cursor is returned if any query is executed, since it's used by\n        subclasses such as InsertQuery). It's possible, however, that no query\n        is needed, as the filters describe an empty set. In that case, None is\n        returned, to avoid any unnecessary database interaction.\n        "
    if (not result_type):
        result_type = NO_RESULTS
    try:
        (sql, params) = self.as_sql()
        if (not sql):
            raise EmptyResultSet
    except EmptyResultSet:
        if (result_type == MULTI):
            return iter([])
        else:
            return
    cursor = self.connection.cursor()
    try:
        cursor.execute(sql, params)
    except Exception:
        cursor.close()
        raise
    if (result_type == CURSOR):
        return cursor
    if (result_type == SINGLE):
        try:
            val = cursor.fetchone()
            if val:
                return val[0:self.col_count]
            return val
        finally:
            cursor.close()
    if (result_type == NO_RESULTS):
        cursor.close()
        return
    result = cursor_iter(cursor, self.connection.features.empty_fetchmany_value, self.col_count)
    if (not self.connection.features.can_use_chunked_reads):
        try:
            return list(result)
        finally:
            cursor.close()
    return result
Run the query against the database and returns the result(s). The
return value is a single data item if result_type is SINGLE, or an
iterator over the results if the result_type is MULTI.

result_type is either MULTI (use fetchmany() to retrieve all rows),
SINGLE (only retrieve a single row), or None. In this last case, the
cursor is returned if any query is executed, since it's used by
subclasses such as InsertQuery). It's possible, however, that no query
is needed, as the filters describe an empty set. In that case, None is
returned, to avoid any unnecessary database interaction.
def execute_sql(self, result_type=MULTI):
    "\n        Run the query against the database and returns the result(s). The\n        return value is a single data item if result_type is SINGLE, or an\n        iterator over the results if the result_type is MULTI.\n\n        result_type is either MULTI (use fetchmany() to retrieve all rows),\n        SINGLE (only retrieve a single row), or None. In this last case, the\n        cursor is returned if any query is executed, since it's used by\n        subclasses such as InsertQuery). It's possible, however, that no query\n        is needed, as the filters describe an empty set. In that case, None is\n        returned, to avoid any unnecessary database interaction.\n        "
    if (not result_type):
        result_type = NO_RESULTS
    try:
        (sql, params) = self.as_sql()
        if (not sql):
            raise EmptyResultSet
    except EmptyResultSet:
        if (result_type == MULTI):
            return iter([])
        else:
            return
    cursor = self.connection.cursor()
    try:
        cursor.execute(sql, params)
    except Exception:
        cursor.close()
        raise
    if (result_type == CURSOR):
        return cursor
    if (result_type == SINGLE):
        try:
            val = cursor.fetchone()
            if val:
                return val[0:self.col_count]
            return val
        finally:
            cursor.close()
    if (result_type == NO_RESULTS):
        cursor.close()
        return
    result = cursor_iter(cursor, self.connection.features.empty_fetchmany_value, self.col_count)
    if (not self.connection.features.can_use_chunked_reads):
        try:
            return list(result)
        finally:
            cursor.close()
    return result