[Tutor] accessing Postgres db results by column name

Martin Walsh mwalsh at mwalsh.org
Sat Apr 10 07:19:57 CEST 2010


Serdar Tumgoren wrote:
> Hey everyone,
> 
> Ricardo was nice enough to post his solution as a recipe on ActiveState.
> For anyone interested in bookmarking it, here's the link:
> 
> http://code.activestate.com/recipes/577186-accessing-cursors-by-field-name/
> 
> Serdar
> 

I really like Ricardo's solution ... attribute access is a nice touch,
bookmarking it now.

FWIW, it would seem that psycopg2 also has a DictCursor (and
DictConnection).

http://initd.org/psycopg/docs/extras.html

HTH,
Marty




More information about the Tutor mailing list