Hey,
I know this is a common topic and it has been discussed before. However even
though I spent a considerable amount of time I was unable to fix my issue.
Situation:
When the MySQL server is restarted I get an OperationalError (as expected) on
the next request. The application uses a scoped session [1].
As far as I know the suggested way for recovery is to add some code like this
in the WSGI middleware stack (using Pylons):
try:
app(...)
finally:
DBSession.remove()
That's already in my code and I can see that the code is executed.. However
under certain circumstances I still get the OperationalError on the next
request which puzzles me.
Somehow I am under the impression that my app [2] might use multiple DB
connections somehow and I'm removing the wrong connection in my finally-handler.
Does that somehow makes sense?
If I limit the connection pool to 1 without any overflow I get a TimeoutError
from the ToscaWidgets stack somewhere. Does that mean my application really
wants multiple DB connections? As far as I am aware I'm only accessing the DB
using a central 'DBSession' object.
Is there a way to find out which actual connection 'DBSession' refers to?
Thank you very much for reading this post. Any pointers/suggestions appreciated.
fs
[1] SQLAlchemy session setup:
maker = sessionmaker()
DBSession = scoped_session(maker)
[2] I'm using MediaCore (www.mediacorecommunity.org), an Open Source web
application written in Python. I am using SQLAlchemy 0.6.8, MySQLdb 1.2.3,
MySQL server 5.5.28, Python 2.7.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.