Skip to content

Commit

Permalink
Fix bug on empty delete in merge table (#940)
Browse files Browse the repository at this point in the history
* fix bug on empty delete in merge table

* update changelog

* fix spelling

---------

Co-authored-by: Chris Brozdowski <[email protected]>
  • Loading branch information
samuelbray32 and CBroz1 authored Apr 22, 2024
1 parent 664f051 commit 96691c3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
- Prioritize datajoint filepath entry for defining abs_path of analysis nwbfile
#918
- Fix potential duplicate entries in Merge part tables #922
- Add logging of AnalysisNwbfile creation time and size #937
- Fix error on empty delete call in merge table. #940
- Add log of AnalysisNwbfile creation time, size, and access count #937, #941

### Pipelines
Expand Down
13 changes: 9 additions & 4 deletions src/spyglass/utils/dj_merge_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,11 +799,16 @@ def merge_populate(self, source: str, keys=None):

def delete(self, force_permission=False, *args, **kwargs):
"""Alias for cautious_delete, overwrites datajoint.table.Table.delete"""
for part in self.merge_get_part(
restriction=self.restriction,
multi_source=True,
return_empties=False,
if not (
parts := self.merge_get_part(
restriction=self.restriction,
multi_source=True,
return_empties=False,
)
):
return

for part in parts:
part.delete(force_permission=force_permission, *args, **kwargs)

def super_delete(self, warn=True, *args, **kwargs):
Expand Down

0 comments on commit 96691c3

Please sign in to comment.