## fonction toDict: Recipe 528939 - Converting DBI results to a list of dictionaries
def toDict(curs):
cols = [column[0] for column in curs.description]
return [dict(zip(cols, row)) for row in curs.fetchall()]
cur = conn.cursor()
query = "SELECT nom, AsText(the_geom), Srid(the_geom) FROM testpoly where nom='%s'" % 'test1'
cur.execute(query)
print toDict(cur)
[{'srid': 4326, 'nom': 'test1', 'astext': 'POLYGON((0.09094470046083 0.807557603686636,0.141635944700461 0.80147465437788,0.360622119815668 0.702119815668203,0.240990783410138 0.548018433179723,0.086889400921659 0.584516129032258,0.054447004608295 0.742672811059908,0.09094470046083 0.807557603686636))'}]