[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.

Rick



On Thu, 2003-03-06 at 11:06, Geir B=C3=A6kholt wrote:
>=20
> erhhmm.. that last mail kinda fired off before i had the time to
> finish it.. so much for hotkeys ;)
>=20
> 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 c=
an
> 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?
>=20
> 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"
>=20
> what you are looking for is most probably
> result.names()
>=20
> :)
>=20
> --
> Geir B=C3=A6kholt
>=20