From: Joshua D. Drake <jd@commandprompt.com>
To: David.Bear@asu.edu
Cc: pgsql-admin@postgresql.org
Subject: Re: using pgdb and python
Date: Thu, 08 Dec 2005 15:25:53 -0800
Message-ID: <1134084353.8592.23.camel@jd.commandprompt.com> (raw)
In-Reply-To: <20051208222737.GD29823@asu.edu>
References: <20051208222737.GD29823@asu.edu>
> 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/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: jd@commandprompt.com, David.Bear@asu.edu
Subject: Re: using pgdb and python
In-Reply-To: <1134084353.8592.23.camel@jd.commandprompt.com>
References: <20051208222737.GD29823@asu.edu> <1134084353.8592.23.camel@jd.commandprompt.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox