def dictfetchall(cursor):
    desc = cursor.description
    return [
        dict(zip([col[0] for col in desc], row))
        for row in cursor.fetchall()
    ]
Returns all rows from a cursor as a dict
dataset/ETHPy150Open bartdag/recodoc2/recodoc2/apps/docutil/commands_util.py/dictfetchall