Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

celery, postgresql -> configure backend

So i'm just getting started with celery and trying to do some simple tests to get a feel for it. Im trying to set a celery to use postgres for my backend. on this page:
http://docs.celeryproject.org/en/latest/getting-started/first-steps-with-celery.html#keeping-results I see the example

celery = Celery('tasks', backend='redis://localhost', broker='amqp://')

So in my code I try

celery = Celery('tasks', 
               backend='sqla+postgresql://celery_exp:celery_exp@myhost/celery_exp',
                broker='sqla+postgresql://celery_exp:celery_exp@myhost/celery_exp',)

but i keep getting this error when starting it:

ImportError: No module named sqla+postgresql

In the docs I've tried different variations such as

postgresql://  
postgresql+psycopg2://  

I know that the connection string is correct besause taking out the backend paramter in the Celery constructor works as expected.
What am i doing wrong here? I feel it must be something stupid because I can't find anything on the net.

thanks in advance.

like image 821
w-- Avatar asked Jan 31 '13 21:01

w--


1 Answers

The answer lies here http://celery.readthedocs.org/en/latest/configuration.html#database-url-examples

You need to prefix your regular SQL Alchemy url string with db+, such as

CELERY_RESULT_BACKEND = "db+postgresql+psycopg2://..."
like image 193
dtheodor Avatar answered Nov 15 '22 00:11

dtheodor