[Zope] Getting SQL record names in python script?

Denis Frere denis@aragne.com
Tue, 13 Nov 2001 14:19:56 +0100


Le Mon, Nov 12, 2001 at 11:57:11PM -0000, azbok@yahoo.com pianota:
> I call a ZSQL method in python and successfully retrieve the
> results I want.  Then I want to get a list of the field names.
> 
> I can cycle through the values no problem.  I thought the
> records returned were each a dictionary.

When you call a ZSQL Method, you get a result object.
If you want dictionaries, just try :

res = ZSQL_Method()
list_of_dicts = res.dictionaries()
first_recdict = list_of_dicts[0]

(That's one of the ways)

Have fun
-- 
Denis FRERE
P3B    : Club Python(-Zope) Belge --------- http://www.p3b.org
OS3B   : Club Open-Software(-Linux) Carolo  http://www.os3b.org 
Aragne : Python-Zope Solutions & Formations http://www.aragne.com