Skip to content

Instantly share code, notes, and snippets.

@rodrigobertin
Created September 17, 2019 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rodrigobertin/92eb7e8025d071899e3751f97920fce2 to your computer and use it in GitHub Desktop.
Save rodrigobertin/92eb7e8025d071899e3751f97920fce2 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment