Skip to content
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

Add additional hook to delete_model allowing action between session.delete and session.commit #1719

Open
cancan101 opened this issue Oct 4, 2018 · 0 comments

Comments

@cancan101
Copy link

cancan101 commented Oct 4, 2018

I suggest adding an additional hook to delete_model allowing actions between session.delete and session.commit.

Currently, delete_model looks like:

self.session.flush()
self.session.delete(model)
self.session.commit()

which means that if you cannot first attempt to delete locally (and then flush to make sure it works) before calling an external service and then finishing with a commit.

Ideally there would be a new hook:

 self.session.flush() 
 self.session.delete(model) 
 self.before_model_delete_commit() # new hook
 self.session.commit() 

This allows getting e.g. integrity errors before I make an external call since I cannot roll back the external call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant