Opened 9 years ago

Closed 4 years ago

#22 closed enhancement (fixed)

Let pgdb support namedtuples

Reported by: cito Owned by: darcy
Priority: major Milestone: 5.0
Component: DB API 2 Version: 4.1
Keywords: named tuples Cc:

Description

Python 2.6 comes with namedtuples. We should utilize these in pg and pgdb.

pg could get a new method namedresult(), and pgdb could provide a row factory for namedtuples (similar to sqlite3).

Change History (3)

comment:1 Changed 7 years ago by cito

Implemented for pg in r447.

comment:2 Changed 4 years ago by cito

  • Summary changed from Let pg and pgdb support namedtuples to Let pgdb support namedtuples

Renamed the ticket to reflect the current status.

comment:3 Changed 4 years ago by cito

  • Keywords named tuples added
  • Milestone changed from 4.2 to 5.0
  • Resolution set to fixed
  • Status changed from new to closed
  • Version changed from 4.0 to 4.1

Support for named tuples has now been added in r683, tests and docs are also included.

I have made this even the default for version 5.0, since the new major version is a good opportunity to make such changes. We used to return rows as lists in the pgdb module, which was not good anyway because it was not in line with the pg module and other database drivers. Note that named tuples can be accessed the same way as lists, so the backward incompatibily is small and would normally not cause troubles.

Note: See TracTickets for help on using tickets.