Thread: Re: How to make a dictoinary list of a query result

Re: How to make a dictoinary list of a query result

From
Mikhail Terekhov
Date:
Use "Classic" interface:

import pg

con = pg.connect(...)
d = con.query('select id,name from account').dictresult()
print d



sanjay wrote:
> Hi All,
>
>   How to make a dictoinary list of a query result.
> Example.
> select id,name from account.
> it should be like [{'name':aaa,'id':12},{'name':bbb,'id':23},...]
>
> Thanks,
> Sanjay