Django Backend-neutral DictCursor
Solution 1:
You could write it in a couple of lines :)
def dict_cursor(cursor):
description = [x[0] for x in cursor.description]
for row in cursor:
yield dict(zip(description, row))
Or if you really want to save space:
simplify_description = lambda cursor: [x[0] for x in cursor.description]
dict_cursor = lambda c, d: dict(zip(d, r) for r in c))