def dictfetchall(cursor):
 desc = cursor.description
 return [dict(list(zip([col[0] for col in desc], row))) for row in cursor.fetchall()]

def dictfetchall ( cursor ) : desc = cursor . description return [ dict ( list ( zip ( [ col [ 0 ] for col in desc ] , row ) ) ) for row in cursor . fetchall ( ) ]
returns all rows from a cursor as a dict .