[Tutor] accessing Postgres db results by column name

Serdar Tumgoren zstumgoren at gmail.com
Mon Apr 12 22:01:04 CEST 2010

Hey folks,

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...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100412/0132fc3d/attachment.html>

More information about the Tutor mailing list