You need to make sure that you are closing your sessions--otherwise,
they keep your connections open, and are never returned to the pool.
Make sure to read up on sessions here:
http://www.sqlalchemy.org/docs/05/session.html
Also, read up on logging:
Definitely go with middleware--it's very clean and simple. Also, make
sure to use sqlalchemy.orm.scoped_session()--it makes using sessions
in Django pretty much transparent; any time you need to work with a
session, you call Session(), and it either uses your current one, or
creates a new one if
*sess* a keywork parameter, that's really
clever!
Thanks a lot!
On Mar 11, 9:05 pm, Jeff FW jeff...@gmail.com wrote:
Logging SA objects *after* the session is gone will always be a
problem, unless you make sure to detach all of them from the session.
I'd just log the original
am, Jeff FW jeff...@gmail.com wrote:
That's pretty similar to what I do, actually, if a bit simpler (but
that's good!) One suggestion would be to throw an except (maybe for
the base SQLAlchemy exception class) in your try block, otherwise you
run the risk of things dying in an ugly way
Don't use scoped_session--you'll run into problems no matter what you
do. I'm using Perspective Broker from Twisted with SQLAlchemy. I
make sure to create and commit/rollback a session for *every* PB
request. It works perfectly, and that's the only way I was really
able to get it to work in