Created
October 23, 2015 20:44
-
-
Save ksindi/c25f6a966a181a88afe7 to your computer and use it in GitHub Desktop.
Return rows as namedtuples
This file contains hidden or 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
names = " ".join(d[0] for d in cursor.description) | |
cls = collections.namedtuple('Results', names) | |
rows = map(cls._make, cursor.fetchall()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment