Convert to dict, pewee raw sql
def convert_to_dict(cursor): column_names = [x[0] for x in cursor.description] all_tables = [dict(zip(column_names, row)) for row in cursor.fetchall()] return all_tables