Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
CBroz1 committed Nov 20, 2024
1 parent 57964fd commit da70e26
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ dj.FreeTable(dj.conn(), "common_session.session_group").drop()
- Remove numpy version restriction #1169
- Merge table delete removes orphaned master entries #1164
- Edit `merge_fetch` to expect positional before keyword arguments #1181
- Allow part restriction `SpyglassMixinPart.delete` #1192

### Pipelines

Expand All @@ -53,9 +54,9 @@ dj.FreeTable(dj.conn(), "common_session.session_group").drop()
- Export fixes #1164
- Allow `get_abs_path` to add selection entry. #1164
- Log restrictions and joins. #1164
- Check if querying table inherits mixin in `fetch_nwb`. #XXXX
- Ensure externals entries before adding to export. #XXXX
- Error specificity in `LabMemberInfo` #XXXX
- Check if querying table inherits mixin in `fetch_nwb`. #1192
- Ensure externals entries before adding to export. #1192
- Error specificity in `LabMemberInfo` #1192

- Decoding

Expand Down
11 changes: 8 additions & 3 deletions src/spyglass/utils/dj_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ def _nwb_table_tuple(self) -> tuple:
Used to determine fetch_nwb behavior. Also used in Merge.fetch_nwb.
Implemented as a cached_property to avoid circular imports."""
from spyglass.common.common_nwbfile import (
from spyglass.common.common_nwbfile import ( # noqa F401
AnalysisNwbfile,
Nwbfile,
) # noqa F401
)

table_dict = {
AnalysisNwbfile: "analysis_file_abs_path",
Expand Down Expand Up @@ -857,4 +857,9 @@ def delete(self, *args, **kwargs):
"""Delete master and part entries."""
restriction = self.restriction or True # for (tbl & restr).delete()

(self.master & restriction).delete(*args, **kwargs)
try: # try restriction on master
restricted = self.master & restriction
except DataJointError: # if error, assume restr of self
restricted = self & restriction

restricted.delete(*args, **kwargs)

0 comments on commit da70e26

Please sign in to comment.