This document describes Celery 2.4. For development docs, go here.

Using SQLAlchemy

Installation

For the SQLAlchemy transport you have to install the kombu-sqlalchemy library:

$ pip install -U kombu-sqlalchemy

Configuration

This transport uses only the BROKER_HOST setting, which have to be an SQLAlchemy database URI.

  1. Set your broker transport:

    BROKER_TRANSPORT = "sqlalchemy"
    
  2. Configure the database URI:

    BROKER_HOST = "sqlite:///celerydb.sqlite"
    

Please see SQLAlchemy: Supported Databases for a table of supported databases. Some other SQLAlchemy Connection String, examples:

# sqlite (filename)
BROKER_HOST = "sqlite:///celerydb.sqlite"

# mysql
BROKER_HOST = "mysql://scott:tiger@localhost/foo"

# postgresql
BROKER_HOST = "postgresql://scott:tiger@localhost/mydatabase"

# oracle
BROKER_HOST = "oracle://scott:tiger@127.0.0.1:1521/sidname"

Results

To store results in the database as well, you should configure the result backend. See Database backend settings.

Limitations

The SQLAlchemy database transport does not currently support:

  • Remote control commands (celeryev, broadcast)
  • Events, including the Django Admin monitor.
  • Using more than a few workers (can lead to messages being executed multiple times).