Select as dictionary...

Carsten Haese carsten at uniqsys.com
Mon Oct 1 10:22:14 EDT 2007


On Mon, 2007-10-01 at 15:50 +0200, Bruno Desthuilliers wrote:
> Besturk.Net Admin a écrit :
> > I want to see this result directly as a dictionary:
> > 
> > {1: 5, 2: 5 .....}
> > 
> > How do i select in this format ?
> 
> IIRC, postgres' db-api connector (well, at least one of them - I don't 
> know which one you're using) has a DictCursor.

That would return the results as a list of dictionaries like this:

[{'id':1, 'w':5}, {'id':2, 'w':5}, ...]

-- 
Carsten Haese
http://informixdb.sourceforge.net





More information about the Python-list mailing list