|
From: Ellen S. <sp...@mi...> - 2002-03-09 20:30:43
|
I'm having trouble decoding a resultSet from a query:
>>> from pyPgSQL.libpq import *
>>> c = PQconnectdb("...")
>>> c.sendQuery("SELECT COUNT(thread_id) FROM thread")
>>> d = c.getResult()
>>> print d.ntuples
1
>>> print d[0]
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: unsubscriptable object
>>> print d.getValue(0)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: getValue
What is the right way to extract the result?
When I try making the same query directly in postgres, it works:
etest=> select COUNT(thread_id) FROM thread;
count
-------
0
(1 row)
Also, can anyone point me to any documentation for pypgsql? I haven't been
able to find it.
Thank you.
Ellen Spertus
|