Part.delete: forward kwargs to super.delete#1310
Part.delete: forward kwargs to super.delete#1310sarpit2907 wants to merge 3 commits intodatajoint:masterfrom
Conversation
|
Thanks for this fix! PR #1312 addresses this issue more comprehensively with a unified New API in #1312The class Part(UserTable, metaclass=PartMeta):
def delete(self, part_integrity: str = "enforce", **kwargs):
"""
Args:
part_integrity: Policy for master-part integrity. One of:
- "enforce" (default): Error - delete from master instead.
- "ignore": Allow direct deletion (breaks master-part integrity).
- "cascade": Delete parts AND cascade up to delete master.
**kwargs: Additional arguments passed to Table.delete()
(transaction, prompt)
"""
if part_integrity == "enforce":
raise DataJointError(...)
super().delete(part_integrity=part_integrity, **kwargs)Migration from old API
The Since #1312 includes this fix as part of a larger API improvement, we've marked it as superseding this PR. Thank you for identifying the issue! |
|
Hi @sarpit2907, thank you for this contribution and for addressing issue #1276! We're closing this PR because DataJoint 2.0 introduces a more comprehensive solution for master-part delete behavior through the `part_integrity` parameter: ```python
This provides a cleaner API than forwarding arbitrary kwargs: ```python DataJoint 2.0 usageSession.Trial.delete(part_integrity="ignore") # Delete parts directly The underlying issue (#1276) about Part table delete flexibility is fully addressed with this new parameter. We appreciate your effort in identifying this limitation! See PR #1312 and the master-part spec for details. |
|
Closing in favor of DataJoint 2.0's part_integrity parameter. Thank you for your contribution! |
|
Thanks @dimitri-yatsenko for the review and for closing this — I understand this is tied to broader changes and may not fit the current direction. I’ve learned a lot from the discussion and will focus next on smaller, low-risk issues (tests/docs/UX) to better align with the project roadmap. |
Fixes #1276
Part.delete()previously only acceptedforce, which prevented forwarding kwargssupported by
Table.delete()(e.g.transaction=False). This change forwardskwargs to
super().delete()whenforce=Truewhile preserving the existing safetybehavior for direct part deletes.
Tests: