On Sun, Jun 17, 2012 at 4:55 PM, W. Matthew Wilson <matt(at)tplus1(dot)com> wrote:
> I understand that when I ask for more than one column in a query,
> psycopg2 MUST return each row as a list. But when I am asking for
> exactly one column, is there a way to tell psycopg2 to not return a
> list for every row, but just the single value?
No, there's nothing like this. For me, any attempt to add a feature
and let the user choose whether to return one-column queries just as
lists or as one-item tuples (a cursor subclass? a function?) seems
more verbose than the [r[0] for r in cur] or map(itemgetter(0), cur)
to get the data the way you want.
-- Daniele