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

From: Mikhail Terekhov <terekhov(at)emc(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: How to make a dictoinary list of a query result
Date: 2003-02-07 19:27:23
Message-ID: 3E44089B.2000002@emc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Browse pgsql-general by date

  From Date Subject
Next Message Berend Tober 2003-02-07 19:49:39 Re: converting Oracle to postgres
Previous Message Dennis Gearon 2003-02-07 18:59:22 user account uniqueness