[Tutor] accessing Postgres db results by column name
zstumgoren at gmail.com
Mon Apr 12 22:01:04 CEST 2010
Wanted to send along one more update about this topic. Steve Orr pointed out
in a comment on Ricardo's new recipe that there's yet another way to get
named attribute access to cursor results.
The secret sauce is namedtuple, "high performance" collection type. This
appears to be the "canonical" approach these days:
The Python Docs have a nice little example of this approach, using both the
csv and sqlite3 modules:
And you can check out Steve's comment at the bottom of Ricardo's recipe:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor