X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1042E9DCB52 for ; Thu, 8 Dec 2005 19:07:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99656-01 for ; Thu, 8 Dec 2005 19:07:21 -0400 (AST) X-Greylist: delayed 00:33:34.580792 by SQLgrey- Received: from post5.inre.asu.edu (post5.inre.asu.edu [129.219.110.120]) by postgresql.org (Postfix) with ESMTP id EACE69DCB11 for ; Thu, 8 Dec 2005 19:07:16 -0400 (AST) Received: from conversion.post5.inre.asu.edu by asu.edu (PMDF V6.1-1X6 #30769) id <0IR700D01AE22R@asu.edu> for pgsql-admin@postgresql.org; Thu, 08 Dec 2005 15:27:38 -0700 (MST) Received: from smtp.asu.edu (smtp.asu.edu [129.219.110.107]) by asu.edu (PMDF V6.1-1X6 #30769) with ESMTP id <0IR700C7LAE2MV@asu.edu> for pgsql-admin@postgresql.org; Thu, 08 Dec 2005 15:27:38 -0700 (MST) Received: from teancum.pp.asu.edu (teancum.pp.asu.edu [129.219.69.212]) by smtp.asu.edu (8.12.10/8.12.10/asu_smtp_relay, nullclient, tcp_wrapped) with ESMTP id jB8MRaj5025149 for ; Thu, 08 Dec 2005 15:27:36 -0700 (MST) Received: by teancum.pp.asu.edu (Postfix, from userid 1000) id 9944ACAE; Thu, 08 Dec 2005 15:27:37 -0700 (MST) Date: Thu, 08 Dec 2005 15:27:37 -0700 From: David Bear Subject: using pgdb and python To: pgsql-admin@postgresql.org Reply-to: David.Bear@asu.edu Message-id: <20051208222737.GD29823@asu.edu> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-disposition: inline User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.48 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.48 X-Spam-Level: X-Archive-Number: 200512/73 X-Sequence-Number: 19793 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 sparse. 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 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. thanks. -- 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"