[sqlalchemy] Re: SQLAlchemy connection errors

2014-09-12 Thread Matthijs Blaas
Ok, i found the issue! When I tried to use pg8000 to connect to postgres i got an error: cannot insert multiple commands into a prepared statement. Apparently multiple queries is fine with psycopg2, but not using pg8000. We prefix all queries because of a workaround. We handle multi-tenancy

[sqlalchemy] Re: SQLAlchemy connection errors

2014-09-11 Thread Matthijs Blaas
Hi Jonathan, Thanks for your response, i removed the newresponse event like you mentioned and added a finished callback to the request (in a tween): request.add_finished_callback(cleanup_db_session) Unfortunatly the plot thickens! Since the last time i tested our project, the problem

[sqlalchemy] Re: SQLAlchemy connection errors

2014-09-10 Thread Jonathan Vanasco
1. I had a concern a few months ago when doing an audit of code. I ended up not having an issue, but this link might be of help: https://groups.google.com/d/topic/sqlalchemy/Z7tMCB_IK1M/discussion 2. I use `add_finished_callback`, which runs unconditionally at the end of every request.