Skip site navigation (1) Skip section navigation (2)

using pgdb and python

From: David Bear <David(dot)Bear(at)asu(dot)edu>
To: pgsql-admin(at)postgresql(dot)org
Subject: using pgdb and python
Date: 2005-12-08 22:27:37
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
I am using python to collect data and insert it into postgresql. I am
hoping there will be someone on this list that has used python for
this becuase all the books and documentation on the subject seem

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 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

   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.


David Bear
phone: 	480-965-8257
fax: 	480-965-9189
College of Public Programs/ASU
Wilson Hall 232
Tempe, AZ 85287-0803
 "Beware the IP portfolio, everyone will be suspect of trespassing"


pgsql-admin by date

Next:From: Joshua D. DrakeDate: 2005-12-08 23:25:53
Subject: Re: using pgdb and python
Previous:From: Matthew T. O'ConnorDate: 2005-12-08 21:35:50
Subject: Re: Installation of PostgresQL 8.1 in Redhat Linux ES 4.0

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group