How do I serialize pyodbc cursor output (from .fetchone, .fetchmany or .fetchall) as a Python dictionary?
I\'m using bottlepy
For situations where the cursor is not available - for example, when the rows have been returned by some function call or inner method, you can still create a dictionary representation by using row.cursor_description
def row_to_dict(row):
return dict(zip([t[0] for t in row.cursor_description], row))