On Thu, 14 Apr 2016 14:53:29 +0300
Martti Laiho <[email protected]> wrote:

> I am writing a tutorial to DBTechNet group on data access APIs of
> programming/scripting languages accessing the mainstream databases.
> On Python I selected PyGreSQL as the driver and in my mind the pgdb
> module Python Dtabase API 2.0 is well documented.  However I have not
> been able to figure out how to catch exception on except line and how
> to read the SQLSTATE and error message information in the Classic
> PyGreSQL module pg.

It should be more or less the same.  Have you got some sample code that
we can look at to see what you are trying?  Perhaps this helps.

>>> import pg
>>> db = pg.DB()
>>> try: db.query("SELECT * FROM NoSuchTable")
... except pg.ProgrammingError as e: print(e)
... 
ERROR:  relation "nosuchtable" does not exist
LINE 1: SELECT * FROM NoSuchTable

-- 
D'Arcy J.M. Cain
PyGreSQL Development Group
http://www.PyGreSQL.org IM:[email protected]
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql

Reply via email to