-
Notifications
You must be signed in to change notification settings - Fork 85
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
Allow including master table in cascading delete #1158
Conversation
@dimitri-yatsenko @ttngu207 Hi Dmitri and Thinh. I just wanted to check in on this pull request and another one (#1160). It would really help us to get these into a new release if that's possible. |
Hi @dimitri-yatsenko @ttngu207, Sorry to bother again, but it would be helpful to know for our (Spyglass) planning purposes whether this PR is likely to get reviewed/merged in the near future. We know there are probably a lot of things on your plate and we understand if this is not among your highest priorities. Thank you for all your work on this software. |
Hi @edeno, I'll review this by end of week. Thanks all for the PR. @ttngu207 @dimitri-yatsenko @lfrank Do we need to publish a new release? Or is it sufficient to merge to |
It would be greatly helpful for us to have a release. |
Thanks, @ethho. I fetched from upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
Looks good overall. I request the following changes:
- Update documentation to reflect the new behavior. It is sufficient to update this section on deletes.
- Rename kwarg to
force_masters
as discussed above - Expand regression tests to cover edge cases
Edge Cases
The logic changes in delete
are sensible and address the requirements laid out in #151.
While I can't think of any breaking edge cases, @ttngu207 and I think that we should include some of these cases in regression tests.
Notably, we should test what happens when a part table is visited more than once in the cascade.
The new tests cover the case where the master table is visited twice, and we save some work by skipping visited_masters
.
But what if a part table shares a master with its children or grandchildren?
cascade
will visit the downstream part table twice.
This is harmless currently because quick_delete
is idempotent, but it's worth testing in case delete behavior changes. For example, we could add a table to schema_simple
:
class I(dj.Part):
definition = """ # test no additional fk reference
-> E
id_i :int
---
-> H
"""
Kwarg Interaction
No change requested, but note that my_part_table.delete(force_parts=False, force_masters=True)
will delete the master table, even though force_parts=False
. This behavior makes sense to me: force_masters=True
will always supercede force_parts
.
Co-authored-by: Ethan Ho <[email protected]>
Thanks for your review @ethho!
Given that this is currently the default behavior, should |
@CBroz1 Based on my reading, Then we should document the behavior well and keep the logic as is, without raising a warning. A warning would get very annoying as the default behavior. One option that I don't endorse is: change default behavior to |
Thanks @ethho, sounds good. I made note of this in the changelog. If we could get this into a |
In my opinion, this change is a large enough to be in the major release |
Sure, that works for me, thanks! Should I make any edits to the changelog to reflect the pre-release? |
Co-authored-by: Ethan Ho <[email protected]>
For anyone urgently blocked on |
Co-authored-by: Ethan Ho <[email protected]>
@CBroz1 @edeno @lfrank This PR was included in release 0.4.2 built by CI. |
#151 included a discussion of 'Option 2' in which the master would be deleted during a cascade, with a possible solution proposed in this PR. This feature would be particularly useful to the Spyglass team because our 'Merge tables' make use of foreign-key references in parts to version pipelines.
Happy to incorporate feedback