-
Notifications
You must be signed in to change notification settings - Fork 302
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
Session should be rolled back on SQLAlchemyError #449
Comments
Hi, Could you please accept my merge request. Because I really want to install flask_restless using pip. And I don't wanna put flask_restless with my fix inside version control. Without this fix, the randomness issue persists. |
@hussaintamboli Why did you close the issue if your code has not been merged? You should re-open the issue. |
This should be fixed by 56c8261. |
Great. Actually the pull request that I had sent before (4bed33f) has the same fix. Thanks. |
Yesterday, I came across a really painful issue.
I use flask-restless and SQLAlchemy for my API. I got Internal server error due to
OperationalError
exception in one of my APIs. It was because one of the required column was not passed to the POST request. After that, for all the subsequent requests I started getting another Internal server error due toInvalidRequestError
exception.After a long search I found that a
rollback()
needs to be issued when an error occurs incommit()
. But in this case the commit and rollback is not in my hands but restful's.So I started looking where and when the rollback is being issued in restless and found these lines in
views.py
Note that
OperationalError
is not handled as a rollback case.So as a FIX to my issue I modified the
views.py
and putOperationalError
in it. Then I thought, to be on safer side why not issue the rollback onSQLAlchemyError
(SQLAlchemy base exception class)I have created a pull request with my fix.
Please let me know your thoughts on this
The text was updated successfully, but these errors were encountered: