Section A.6. Should I Use SQLAlchemy or SQLObject?

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:

  1. There are some less-common needs that need to be accommodated.

  2. A new "best" approach is discovered.

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.

Rapid Web Applications with TurboGears(c) Using Python to Create Ajax-Powered Sites
Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites
ISBN: 0132433885
EAN: 2147483647
Year: 2006
Pages: 202

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: