Mapping Column Names to results using DBI

Timothy Grant tjg at avalongroup.net
Wed Jan 19 18:15:24 EST 2000


Lance Ellinghaus wrote:
>     dsc = cur.description
>     l = len(dsc)
>     lst = cur.fetchall()
>     rtn = []
>     for data in lst:
>      dict = {}
>      for i2 in range(l):
>          dict[string.lower(dsc[i2][0])] = data[i2]
>      rtn.append(dict)
>     return rtn

Lance,

Thanks so much for your prompt reply.

I guess the above means that the DBI spec *doesn't* call for this
behaviour. I actually find that quite surprising, I just recently had
need to parse a CSV file and found a CSV module up on the Vaults, and it
had behaviour like I was looking for, so when I couldn't figure it out
from the spec, I thought I must be missing something.

I'll give it a whirl and see what happens.

Once again, thanks.

-- 
Stand Fast,
    tjg.

Chief Technology Officer              tjg at exceptionalminds.com
Red Hat Certified Engineer            www.exceptionalminds.com
Avalon Technology Group, Inc.                   (503) 246-3630
>>>>>>>>>>>>EXCEPTIONAL MINDS, INNOVATIVE PRODUCTS<<<<<<<<<<<<




More information about the Python-list mailing list