Re: [cx-oracle-users] Results as dict
Brought to you by:
atuining
From: Christian K. <ckl...@no...> - 2006-11-08 15:18:15
|
Amaury Forgeot d'Arc schrieb: > Christian Klinger wrote: >> Hello cx_oracle users, >> >> who knows a simple way to get results from a fetchall as dict´s instead >> of lists?? > > You may use the cursor.description to get the column names. Something like: > > data = cur.fetchall() > desc = cur.description > dict_data = [dict((col[0], value) for col, value in zip(desc, row)) > for row in data] > > Hope this helps, > Helps perfect, btw other database-modules have out of the box solutions for this (mysql,informix) thx a lot christian |