Re: using pgdb and python

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: David(dot)Bear(at)asu(dot)edu
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: using pgdb and python
Date: 2005-12-08 23:25:53
Message-ID: 1134084353.8592.23.camel@jd.commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin


> I am using pgdb. I know psycpg is also a DBI compliant interface for
> postgresql. If there is a recommendation as to which one is better,
> I'd like to hear it. (better for me now means that it has better
> documentation, sample code, etc.)

I know nothing of pgdb but Command Prompt uses psycopg exclusively and
it works very well.

>
> I am constructing a sql insert statement (parameterized) and would
> like to catch meaningfull exceptions like, keyviolation (on the
> insert) or other postgresql exceptions that might happen. So far the
> only exception I see from pgdb when I do a full traceback and anlyze
> that. What I would like is something like
>
> try:
> cursor.execute(sql, parameters)
> except KeyViolation:
>
> except DataConversionError:
>
> and such like.
>
> I would really appreciate any pointers you might have on using python
> with postgresql.

I would look at psycopg and specifically psycopg2.

Joshua D. Drake

>
> thanks.
>
--
The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: PLphp, PLperl, ODBCng - http://www.commandprompt.com/

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Qingqing Zhou 2005-12-09 04:18:34 Re: REINDEX Issue - DB Management
Previous Message David Bear 2005-12-08 22:27:37 using pgdb and python