diff --git a/CHANGELOG.md b/CHANGELOG.md index 39c54b9a1..8e6997e68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ dj.FreeTable(dj.conn(), "common_session.session_group").drop() #1108 - Add docstrings to all public methods #1076 - Update DataJoint to 0.14.2 #1081 -- Allow restriction based on parent keys in `Merge.fetch_nwb()` #1086 +- Allow restriction based on parent keys in `Merge.fetch_nwb()` #1086, #1126 - Import `datajoint.dependencies.unite_master_parts` -> `topo_sort` #1116 ### Pipelines diff --git a/src/spyglass/utils/dj_merge_tables.py b/src/spyglass/utils/dj_merge_tables.py index b2ddbff93..dbe626408 100644 --- a/src/spyglass/utils/dj_merge_tables.py +++ b/src/spyglass/utils/dj_merge_tables.py @@ -853,6 +853,9 @@ def extract_merge_id(cls, restriction) -> Union[dict, list]: merge_id present in the input, relying on parent func to restrict on secondary or part-parent key(s). + Assumes that a valid set of merge_id keys should have OR logic + to allow selection of an entries. + Parameters ---------- restriction : str, dict, or dj.condition.AndList @@ -878,9 +881,7 @@ def extract_merge_id(cls, restriction) -> Union[dict, list]: merge_restr = [x for x in merge_id_list if x is not None] elif isinstance(restriction, str): parsed = [x.split(")")[0] for x in restriction.split("(") if x] - merge_restr = dj.condition.AndList( - [x for x in parsed if "merge_id" in x] - ) + merge_restr = [x for x in parsed if "merge_id" in x] if len(merge_restr) == 0: return True