In my pyramid app, a celery task was giving me: "Task lr.queue.tasks.fetch_bmark_content[b667d64c-5505-408c-bd12-f9a1863b2e7c] raised unexpected: UnboundExecutionError('Could not locate a bind configured on mapper Mapper|Bmark|bmarks, SQL expression or this Session',)"
from reading around it appears that the engine is not bound to the Session. So I guess I have to initialize the Session in my tasks.py file also. I have a method in my models.__init__.py file called initialize_sql which does this, but it is only called from the main entry point of the pyramid app. So I do this in tasks.py(added line with '# +'): from lr.models import initialize_sql from .celery import load_ini INI = load_ini() initialize_sql(INI) # + def initialize_sql(settings): """Called by the app on startup to setup bindings to the DB""" engine = engine_from_config(settings, 'sqlalchemy.') DBSession.configure(bind=engine) Base.metadata.bind = engine from lr.models.auth import User if not hasattr(Bmark, 'user'): Bmark.user = relation(User, backref="bmark") When I run the app, it initializes from the main entry point fine, but when I open a page that requires any sort of db access, I get: OperationalError: (OperationalError) unable to open database file None None I simply do not get this, why would calling initialize_sql() in an unrelated context cause an issue? I feel stuck, if I 'fix' one thing it breaks another. Any suggestions? first celery stack trace: http://pastebin.com/4P1bL4xw stacktrace: http://pastebin.com/UJrF2W5G tasks.py: http://pastebin.com/2jC7Hs8x celery.py: http://pastebin.com/JbAehA2Q main __init__.py: http://pastebin.com/mbkYy6Wu Michael -- You received this message because you are subscribed to the Google Groups "sqlalchemy-alembic" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alembic+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.