Re: [sqlalchemy] Too slow commit?

2016-03-25 Thread TomS.
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

Re: [sqlalchemy] Too slow commit?

2016-03-22 Thread Jonathan Vanasco
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

Re: [sqlalchemy] Too slow commit?

2016-03-22 Thread TomS.
Thank you for your answer! Function B is called after A. Literally: / //functionA()// //functionB()/ It works fine when at the end of A /inserting_session.close_all()/ is called, but it is not very elegant (moreover it probably causes "MySQL server has gone away", but this is a different

Re: [sqlalchemy] Too slow commit?

2016-03-22 Thread Simon King
It sounds like the transaction for task B is starting before A's transaction has been committed, but you haven't really given enough information to debug further. How are you managing your sessions and transactions? Do B and A actually overlap (ie. does B start before A finishes)? Simon On Tue,

[sqlalchemy] Too slow commit?

2016-03-22 Thread TomS.
Could you advise what would be the best approach for the following problem. I have Flask-Celery task. Task consists of two functions (both are run in the same one Celery task): A and B. Function A calculates values which are then used by B function. Values are stored in DB (via SQLAlchemy).