-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Can't reconnect until invalid transaction is rolled back" #687
Comments
This issue is affecting my project. Anyone have a work-around? |
+1 |
bac and I figured out a way to get some of this working cleanly for the 0.17.x release but you have to add a preprocessor step, and we had to modify the session code a bit. Hopefully for the 1.0 branch we can work on fixing some of this as well. The root of the problem is that a single "session" reference can go stale, and even if your app is using pooling or cleaning up the session it will have failed that 1 request (randomly or based on MySQL connection kills). That means the .session on all your APIs will go bad without some way of resetting it. https://github.com/UberMeatShield/flask-restless/tree/0.17.1 . I am trying to figure out how to contribute this back but the 0.17 tag is super stale, and I cannot currently figure out all the versions of python / requirements that will get the tests to pass. Working on that, but hopefully having a branch that can work helps somebody if I cannot get a MR for 0.17 in a sensible state.
|
the issue still open.
use these way to create manager
manager_restless = APIManager(app, session=data_dict_session)
use blueprint to create api
blueprint_table = manager_restless.create_api_blueprint(***)
app.register_blueprint(blueprint_table)
add postprocessors to close session
def update_result_format(result, search_params=None, **kw):
session.remove()
but it still throw the Exception:
unexpected internal error occurs: (sqlalchemy.exc.InvalidRequestError) Can't reconnect until invalid transaction is rolled back [SQL: u'SELECT count(*) AS count_1 \nFROM dw_table \nWHERE dw_table.id != %s'] [parameters: [{}]]
version: 0.17.0
The text was updated successfully, but these errors were encountered: