[Zope-DB] DCOracle2 - Result as dict instead of a tuple

Dieter Maurer dieter at handshake.de
Fri Nov 19 13:48:43 EST 2004


Christian Klinger wrote at 2004-11-19 10:09 +0100:
> ...
>is it possible to get in this script a dict instead of a tuple?
> ... cursor.fetchall() ...

I think there is a third party tool on top of the DB-API
that provides this feature. I do not know its name. Search
the "db-sig at python.org" mailing list.

On the other hand, it is very easy to write such a tool yourself.
"cursor.description" gives you information about each column.
Among it, its name. With this, you can transform your result
set into a set of dictionaries.

-- 
Dieter


More information about the Zope-DB mailing list