[Zope-DB] python scripts . again

Chris Muldrow muldrow@mac.com
Thu, 06 Mar 2003 13:59:44 -0500


Take a look at this:
http://www.zope.org/Members/spinwing/ZSQL_Results

On 3/6/03 1:48 PM, "D. Rick Anderson" <ruger@acsnv.com> wrote:

> Still being Mr. Newbie here. While iterating through the results of an
> SQL query. How do I get the column names? I'm running a query that can
> return different columns depending on how it's run, and I need the
> script to pull the column names:
> 
> results = context.TestSQL(cltid=102)
> if results:
>   print results
>   for row in results:
>       for column in row:
>           print column
> 
> return printed
> 
> 
> So what exactly is results? Is it a list of dictionaries? If that's the
> case then this is just a python question. How do I get a list of the
> keys in each dictionary?
> 
> TIA
> 
> Rick
> 
> 
> 
> 
> _______________________________________________
> Zope-DB mailing list
> Zope-DB@zope.org
> http://mail.zope.org/mailman/listinfo/zope-db
>