sqlalchemy.rst 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. .. _broker-sqlalchemy:
  2. ==================
  3. Using SQLAlchemy
  4. ==================
  5. .. admonition:: Experimental Status
  6. The SQLAlchemy transport is unstable in many areas and there are
  7. several issues open. Unfortunately we don't have the resources or funds
  8. required to improve the situation, so we're looking for contributors
  9. and partners willing to help.
  10. .. _broker-sqlalchemy-installation:
  11. Installation
  12. ============
  13. .. _broker-sqlalchemy-configuration:
  14. Configuration
  15. =============
  16. Celery needs to know the location of your database, which should be the usual
  17. SQLAlchemy connection string, but with the ``sqla+`` prefix added:
  18. .. code-block:: python
  19. broker_url = 'sqla+sqlite:///celerydb.sqlite'
  20. This transport uses only the :setting:`broker_url` setting, which have to be
  21. an SQLAlchemy database URI.
  22. Please see `SQLAlchemy: Supported Databases`_ for a table of supported databases.
  23. Here's a list of examples using a selection of other `SQLAlchemy Connection Strings`_:
  24. .. code-block:: python
  25. # sqlite (filename)
  26. broker_url = 'sqla+sqlite:///celerydb.sqlite'
  27. # mysql
  28. broker_url = 'sqla+mysql://scott:tiger@localhost/foo'
  29. # postgresql
  30. broker_url = 'sqla+postgresql://scott:tiger@localhost/mydatabase'
  31. # oracle
  32. broker_url = 'sqla+oracle://scott:tiger@127.0.0.1:1521/sidname'
  33. .. _`SQLAlchemy: Supported Databases`:
  34. http://www.sqlalchemy.org/docs/core/engines.html#supported-databases
  35. .. _`SQLAlchemy Connection Strings`:
  36. http://www.sqlalchemy.org/docs/core/engines.html#database-urls
  37. .. _sqlalchemy-results-configuration:
  38. Results
  39. -------
  40. To store results in the database as well, you should configure the result
  41. backend. See :ref:`conf-database-result-backend`.
  42. .. _broker-sqlalchemy-limitations:
  43. Limitations
  44. ===========
  45. The SQLAlchemy database transport does not currently support:
  46. * Remote control commands (:program:`celery events` command, broadcast)
  47. * Events, including the Django Admin monitor.
  48. * Using more than a few workers (can lead to messages being executed
  49. multiple times).