Created
September 17, 2019 13:12
-
-
Save rodrigobertin/92eb7e8025d071899e3751f97920fce2 to your computer and use it in GitHub Desktop.
Convert to dict, pewee raw sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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