Great - I've implemented mentioned pattern and it works!
Thank you!
On 03/22/2016 07:10 PM, Jonathan Vanasco wrote:
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 [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.