-
Notifications
You must be signed in to change notification settings - Fork 58
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
enforce_atomic decorator for commit callbacks to workaround MySQL limitations #106
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportPatch coverage:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #106 +/- ##
==========================================
- Coverage 92.95% 92.90% -0.05%
==========================================
Files 59 59
Lines 3817 3848 +31
Branches 245 254 +9
==========================================
+ Hits 3548 3575 +27
- Misses 224 226 +2
- Partials 45 47 +2
☔ View full report in Codecov by Sentry. 📢 Have feedback on the report? Share it here. |
Maybe one could create a feature request at the django project for a |
I was thinking if the change was made in django-hordak, you could throw an exception when attempting to save a |
And that does not cover all cases. You can change an object without calling save. For example by calling update |
FWIW: I'm not keen on adding complexity to the core Hordak codebase in order to support MySQL's limitations (which includes the current use of Adding complexity and workarounds to Hordak's core feels like pushing in the wrong direction to me. I'm open to conversation on this, but I'm currently leaning towards Hordak having 'MySQL support with caveats'. |
Possible solution to an issue noticed here with the MySQL implementation of the Account and Leg triggers
We were using
transaction.on_commit
to call stored procedures after the transaction had been committed, which successfully raise an error but do not probably rollback changes since the commit has already taken place.Mostly an experiment, there are almost certainly reasons why this approach may be unsuitable.
Since MySQL doesn't have deferred triggers, the only way I can see of us enforcing these triggers is to call them from Python code.
As you can see some of the tests fail, this is because this approach currently only works if functions are decorated with
@enforce_atomic