February 1, 2007

ZSQLAlchemy

A proof-of-concept integration of SQLAlchemy into Zope 2

Over the last few days I played around with SQLAlchemy in order to find ways out of the SQL hell. As a result (or call it a quick hack)  I implemented a  wrapper  ZSQLAlchemy that integrates SQLAlchemy with Zope 2. The wrapper (right now) only cares about the connection and transaction handling and exposes a session and a metadata object (which is usually enough for writing applications based on SQLAlchemy). The session participates in the transaction handling of Zope. This means that a Zope commit will also trigger a session.flush() operation.

ZSQLAlchemy will never be a higher-level framework (e.g. like the (over-engineered) Alchemist framework for Plone).  You can compare it with a standard Zope database adapter.

You might grab ZSQLAlchemy from svn.zope.org and play with it. At the moment it will work with Postgres only. Support for other databases (the ones supported by SQLAlchemy) can be added easily.