[Zope-DB] python scripts . again

D. Rick Anderson ruger@acsnv.com
06 Mar 2003 12:31:47 -0800

Once more, since the first on fell victim to the "zope-db doesn't show
up in the reply" thingy:  :-)

results.names() is EXACTLY what I was looking for. Thanks!

And thanks to Chris for the reference as well.


On Thu, 2003-03-06 at 11:06, Geir B=C3=A6kholt wrote:
> 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 =
> DRA> SQL query. How do I get the column names? I'm running a query that c=
> 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 =
> 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=
> look for the section named
> "Other Result Object Methods"
> what you are looking for is most probably
> result.names()
> :)
> --
> Geir B=C3=A6kholt