A.6. Should I Use SQLAlchemy or SQLObject?
Philosophically, we try to present one way to do common tasks with TurboGears. But, there are two places where we need to deviate from that:
SQLAlchemy is supported in TurboGears for both of these reasons.
If you are connecting TurboGears to a legacy database, you will find that SQLAlchemy can handle a much wider variety of potential schemas. If you have specific performance constraints, SQLAlchemy also makes it easier to optimize the SQL that is produced while still maintaining database independence and a Python feel.
We think that SQLAlchemy is maturing into the best database access layer available for Python. For many applications, we would opt for SQLAlchemy rather than SQLObject. However, because TurboGears provides many more tools for working with SQLObject databases, SQLObject might be a better choice for newcomers to TurboGears and Python.
As with any choice in software, the choice you make almost always depends on the application at hand and the people involved.
We hope to eventually have a compatibility layer that makes migration from SQLObject to SQLAlchemy easy. For now, the following section will help you make the move if you start with SQLObject and later decide that you need specific features offered by SQLAlchemy.