def fetchall_as_namedtuple(cursor):
    Result = _namedtuple_from_cursor(cursor)
    return [Result(*row) for row in cursor.fetchall()]
Return all rows from a cursor as a namedtuple
dataset/ETHPy150Open dimagi/commcare-hq/corehq/form_processor/utils/sql.py/fetchall_as_namedtuple