Skip to content Skip to sidebar Skip to footer

Sqlalchemy Session Handling In Delayed Celery Tasks

I am using a relational database via SQLAlchemy. I want to spawn a job that deals with databases using Celery. There is a code: from sqlalchemy.orm.session import Session from cele

Solution 1:

You should be able to initiate your session with the worker signals: http://celery.readthedocs.org/en/latest/userguide/signals.html#worker-signals

If you use a singleton-like pattern to make sure you always have a session available in that thread than everything should work just fine.

Post a Comment for "Sqlalchemy Session Handling In Delayed Celery Tasks"