Am 05.08.2015 um 12:39 schrieb huangshengHUANGSHENG:
i want to use pure python or Java library like zxjdbc to connect to
postgresql ...

But i don't find corresponding function dictresult() in jdbc or p8000,
what is it used for?

This method was in the classic PyGreSQL interface that was developed before DBAPI2. It returns the result rows as Python dictionaries.

All modern drivers like pg8000 use the DBAPI2 functions, and PyGreSQL also has a DBAPI2 compatible API now. You need to rewrite your code for DBAPI2, or you write a facade that simulates the classic PyGreSQL API. Unfortunately, DBAPI2 returns rows only as tuples, not as dicts. But you can convert the tuples to dicts for instance by zipping them with cursor.description.

The DBAPI2 is described here:
https://www.python.org/dev/peps/pep-0249/

An example of pg8000 usage is here:
http://pythonhosted.org/pg8000/quickstart.html#interactive-example

-- Christoph
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql

Reply via email to