[Zope-DB] python scripts . again
Geir Bækholt
Geir Bækholt
Thu, 6 Mar 2003 20:06:37 +0100
erhhmm.. that last mail kinda fired off before i had the time to
finish it.. so much for hotkeys ;)
DRA> Still being Mr. Newbie here. While iterating through the results of an
DRA> SQL query. How do I get the column names? I'm running a query that can
DRA> return different columns depending on how it's run, and I need the
DRA> script to pull the column names:
...
DRA> So what exactly is results? Is it a list of dictionaries? If that's the
DRA> case then this is just a python question. How do I get a list of the
DRA> keys in each dictionary?
results is a Result class instance
There is a lot of info on it here :
http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/RelationalDat=
abases.stx
look for the section named
"Other Result Object Methods"
what you are looking for is most probably
result.names()
:)
--
Geir Bækholt