SQLAlchemy 0.5 Documentation

Multiple Pages | One Page
Version: 0.5.0rc4 Last Updated: 11/14/08 16:38:11

Overview

The SQLAlchemy SQL Toolkit and Object Relational Mapper is a comprehensive set of tools for working with databases and Python. It has several distinct areas of functionality which can be used individually or combined together. Its major API components, all public-facing, are illustrated below:

           +-----------------------------------------------------------+
           |             Object Relational Mapper (ORM)                |
           |                [tutorial]    [docs]                       |
           +-----------------------------------------------------------+
           +---------+ +------------------------------------+ +--------+
           |         | |       SQL Expression Language      | |        |
           |         | |        [tutorial]  [docs]          | |        |
           |         | +------------------------------------+ |        |
           |         +-----------------------+ +--------------+        |
           |        Dialect/Execution        | |    Schema Management  |
           |              [docs]             | |        [docs]         |
           +---------------------------------+ +-----------------------+
           +----------------------+ +----------------------------------+
           |  Connection Pooling  | |              Types               |
           |        [docs]        | |              [docs]              |
           +----------------------+ +----------------------------------+

Above, the two most significant front-facing portions of SQLAlchemy are the Object Relational Mapper and the SQL Expression Language. These are two separate toolkits, one building off the other. SQL Expressions can be used independently of the ORM. When using the ORM, the SQL Expression language is used to establish object-relational configurations as well as in querying.

back to section top

Tutorials

back to section top

Reference Documentation

back to section top

Installing SQLAlchemy

Installing SQLAlchemy from scratch is most easily achieved with setuptools. (setuptools installation). Just run this from the command-line:

# easy_install SQLAlchemy

This command will download the latest version of SQLAlchemy from the Python Cheese Shop and install it to your system.

Otherwise, you can install from the distribution using the setup.py script:

# python setup.py install

Installing a Database API

SQLAlchemy is designed to operate with a DB-API implementation built for a particular database, and includes support for the most popular databases:

back to section top

Checking the Installed SQLAlchemy Version

This documentation covers SQLAlchemy version 0.5. If you're working on a system that already has SQLAlchemy installed, check the version from your Python prompt like this:

>>> import sqlalchemy
>>> sqlalchemy.__version__ 
0.5.0
back to section top

0.4 to 0.5 Migration

Notes on what's changed from 0.4 to 0.5 is available on the SQLAlchemy wiki at 05Migration.

back to section top
Next: Object Relational Tutorial