[DB-SIG] return list of dictionaries

Kevin Jacobs jacobs@penguin.theopalgroup.com
Thu, 14 Feb 2002 12:07:26 -0500 (EST)


On Thu, 14 Feb 2002, Karl Diedrich wrote:
> Has anyone thought about alternatives to cursor.fetchXXX that return a
> list of dictionaries instead of
> a list of tuples.
>
> Then rows could be referenced by name. It would be easier to change code
>
> without breaking the order that
> has to be in the tuples.

Yes, this has been tried and has some distinct disadvantages for naive
implementations.  However, there are some efficient alternatives that you
may want to look at: http://www.lyra.org/greg/python/dtuple.py or my Python
2.2 module found on http://opensource.theopalgroup.com/.

-Kevin

--
Kevin Jacobs
The OPAL Group - Enterprise Systems Architect
Voice: (216) 986-0710 x 19         E-mail: jacobs@theopalgroup.com
Fax:   (216) 986-0714              WWW:    http://www.theopalgroup.com