Yes, the approach would be to use the exact same session: dbSession = SQLSession.sql_session() functionA() functionB() dbSession.close()
It looks like functionA and functionB each call `SQLSession.sql_session()`, which will cause problems. I believe that will create multiple sessions, which will have different data and may cause blocking and transactional issues. I usually write my celery tasks like this: def task_foo(): dbSession = new_session() functionA(dbSession) functionB(dbSession) dbSession.close() -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.