diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b4f579ae..d6eda918e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/spyglass/utils/dj_merge_tables.py b/src/spyglass/utils/dj_merge_tables.py index f94645ccf..2b8aab5ef 100644 --- a/src/spyglass/utils/dj_merge_tables.py +++ b/src/spyglass/utils/dj_merge_tables.py @@ -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):