[DB-SIG] May we get an actual ANSWER to the F.A.Q...How can I
construct a dictionary???
luis miguel morillas
morillas at posta.unizar.es
Mon Sep 22 16:47:48 EDT 2003
Asunto: [DB-SIG] May we get an actual ANSWER to the F.A.Q...How can I construct a dictionary???
Fecha: lun, sep 22, 2003 at 02:22:02 -0700
Citando a Vernon Cole (wnvcole at peppermillcas.com):
> I have been away from the leading edge for a long time, and am trying to
> jump back
> in and learn the new stuff. Python seems like a GREAT tool.
> But.....
>
> From:
> ...PEP: 249
> ...Title: Python Database API Specification v2.0
> ...Version: $Revision: 1.9 $
> I extract the following:
> vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
> Question:
>
> How can I construct a dictionary out of the tuples returned by
> .fetchxxx():
>
> Answer:
>
> There are several existing tools available which provide
> helpers for this task. Most of them use the approach of using
> the column names defined in the cursor attribute .description
> as basis for the keys in the row dictionary.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Nice to hear that there are "several existing tools".
>
> I have been searching for a week now, but cannot find any of them.
>
> Would someone be so kind as to actually publish a LIST of such tools??
>
Perhaps Python Database Row Module Version 0.71
(work in progress -- check back often for updates)
This Python 2.2 module defines light-weight objects
which allow very flexible access to a fixed number
of positional and named attributes via several interfaces.
Or, more simply, these objects are a better way of returning
the results of database queries, since they allow effcient
access to fields by name or by index. It uses some of the new
features of the Python 2.2 class system, and provide a nice
demonstration of how to take advantage of them.
http://opensource.theopalgroup.com/
> I find it difficult to believe that the "latest and greatest" tools
> available
> in the 21st century still cannot return a value from a named field (column)
> in one row of a database. Good grief! How can I NOT have a feature on a 256
> MB Pentium in 2003 that I had
> on a 30 KB PDP-11 in 1983?
> Was RDM _that_ far ahead of its time?
> --------------
> Vernon Cole
> once (a long time ago) a developer of RDM.
> wnvcole AT nospam.peppermillcas.com
>
>
>
>
> _______________________________________________
> DB-SIG maillist - DB-SIG at python.org
> http://mail.python.org/mailman/listinfo/db-sig
--
Luis Miguel
# Por un mundo con conocimiento libre #
No a las patentes de software
http://www.zaralinux.org - http://www.hispalinux.es
http://www.augustux.org
More information about the DB-SIG
mailing list