[Zope-DB] DCOracle2 - Result as dict instead of a tuple

Dario Lopez-Kästen dario at ita.chalmers.se
Fri Nov 19 06:21:03 EST 2004


Christian Klinger wrote:
> Hello
> 
> is it possible to get in this script a dict instead of a tuple?
> 
> I know that in python-mysql it is possible!

My guess: (w/o knowing exactly how DCOracle2 works on the python side of 
life):

print t.dictionaries()?

HTH
/dario

> 
> ---------------------------
> import DCOracle2
> conn = DCOracle2.connect('xxx/xxx at xxx')
> cursor = conn.cursor()
> 
> 
> def getProps(p):
>         sqlstate = "%s" %(p)
>         #print "SQLSTATE : %s" %sqlstate
>         #sqlstate = "select %s from props" %(p)
>         cursor.execute(sqlstate)
>         erg = cursor.fetchall()
>         return erg
> 
> t = getProps(p="select * from swfert.vweb_anrede order by 2")
> print t
> -----------------------------
> 
> 


-- 
-- -------------------------------------------------------------------
Dario Lopez-Kästen, IT Systems & Services Chalmers University of Tech.


More information about the Zope-DB mailing list