[DB-SIG] SQLAlchemy and py-postgresql?

James Pye lists at jwp.name
Wed Apr 8 00:28:46 CEST 2009


On Apr 7, 2009, at 11:55 AM, Marco A. Gonzalez wrote:
> I understand that py-postgresql provides a DB-API 2.0 interface for  
> using a PostgreSQL database. However, when I read about SQLAlchemy  
> at http://www.sqlalchemy.org/docs/05/dbengine.html#supported-dbapis  
> I saw that it uses psycopg2 for supporting Postgres.

py-postgresql only supports Python 3.0. Both are very new. psycopg2  
only supports Python 2.x, AFAIK. If you are wanting to use sqlalchemy  
with Python 3 and PostgreSQL, py-postgresql and pg8000 would be your  
only "hopes", atm..

> Is there a reason I can't use py-postgresql with SQLAlchemy? What's  
> the relationship between the py-postgresql and SQLAlchemy and  
> psycopg2?

Depends. Does SQLAlchemy support Python 3? psycopg2 and py-postgresql  
are completely different projects, so there will naturally be  
inconsistencies despite their DB-API conformance. *If* SQLAlchemy  
supports Python 3, it may be as easy as switching out a module path in  
some config file, but that is unlikely.


That said, if you want to use SQLAlchemy, you will probably need to  
use psycopg2.


More information about the DB-SIG mailing list