postgresql when it's not your job

19:04

Waiting for psycopg2.3: NamedTuples

6 November 2010

Christmas just came early for me. psycopg2.3, now in beta, includes named tuples as return values from queries.

If you are tired of writing result[4], and would much prefer to write result.column_name, you now can.

Yay!

Peter Eisentraut at 13:48, 9 November 2010:

You could always have been writing result[‘column_name’] via DictCursor, RealDictCursor, etc. Writing result[4] was never necessary in recent memory.

Xof at 00:17, 10 November 2010:

True, true. The named tuple syntax is much cleaner, though.