Which Python module for PostgreSQL?

Mike C. Fletcher mcfletch at rogers.com
Wed Mar 3 01:07:41 CET 2004

W. Borgert wrote:

>I'm not new to Python, but new to databases and PostgreSQL.
>I like to write a PostgreSQL client application (not code
>running inside of the RDBMS), and Debian has four modules:
>python2.3-pgsql - A Python DB-API 2.0 interface to PostgreSQL v7.x
Also known as pyPgSQL, my personal choice, mostly because it is BSD 
licensed, compiles easily on Win32 and is fairly DB-API compliant.  
Authors have been fairly responsive to my bug reports over the months.

>python2.3-popy - module providing access to PostgreSQL from Python2.3
One of the more popular ones.  Last I heard it was still GPL licensed, 
though apparently there's some plans to make it BSD licensed as it 
merges with pygresql. IIRC it has a very strong Zope DA.

>python2.3-psycopg - Python 2.3 module for PostgreSQL
GPL-licensed AFAIK, apparently designed to be more thread-safe and 
efficient than "the others".  Again, popular.  Again, I seem to recall 
that it has a strong Zope DA.

>python2.3-pygresql - PostgreSQL module for Python
Ancient code (maintained by my business partner incidentally) which 
predates the DB-API (though is still maintained), intention is to merge 
the project with PoPy.  BSD-style License (it's part of the postgresql 
tree). This is *not* a DB-API module, and I personally would *not* 
suggest using it in new code unless you desperately need the special 
features of the "classic" API it provides... and even then...

>Now I'm confused: Which one should I use?  I'm going to try
>python2.3-psycopg, but maybe the other variants are "easier
>to use"?  Or faster?  Or more complete?  Thread-safe?
Mostly licensing issues, thread safety and efficiency are the 
differentiators AFAICS.

Good luck,

  Mike C. Fletcher
  Designer, VR Plumber, Coder

More information about the Python-list mailing list