Обсуждение: Need help for converting query result to list of dictoinary

Поиск
Список
Период
Сортировка

Need help for converting query result to list of dictoinary

От
sanjay2kind@yahoo.com (sanjay)
Дата:
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

Re: Need help for converting query result to list of dictoinary

От
Tilo Schwarz
Дата:
sanjay writes:
> 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},...]

It looks like Python to me, so have a look at pgqueryobject.dictresult() :

http://www.postgresql.com/docs/view.php?version=7.3&idoc=0&file=pygresql-pgqueryobject-dictresult.html

Regards,

    Tilo