From b5652d5e9c9260269402a6ea2f61e91716fd7c5b Mon Sep 17 00:00:00 2001 From: Sam Bray Date: Wed, 10 Apr 2024 15:40:27 -0700 Subject: [PATCH 1/2] check for entry in merge part table prior to insert --- src/spyglass/utils/dj_merge_tables.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/spyglass/utils/dj_merge_tables.py b/src/spyglass/utils/dj_merge_tables.py index 37dc62fe0..c5461e75c 100644 --- a/src/spyglass/utils/dj_merge_tables.py +++ b/src/spyglass/utils/dj_merge_tables.py @@ -332,6 +332,9 @@ def _merge_insert(cls, rows: list, part_name: str = None, **kwargs) -> None: + f"{part_name}:\n\tData:{row}\n\t{keys}" ) key = keys[0] + if part & key: + print(f"Key already in part {part_name}: {key}") + continue master_sk = {cls()._reserved_sk: part_name} uuid = dj.hash.key_hash(key | master_sk) master_pk = {cls()._reserved_pk: uuid} From d3433102702a5cc885921bd7975a2f6b807002ce Mon Sep 17 00:00:00 2001 From: Sam Bray Date: Wed, 10 Apr 2024 15:47:18 -0700 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d011da68..3001bd4f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Fix errors in config import #882 - Save current spyglass version in analysis nwb files to aid diagnosis #897 - Add pynapple support #898 +- Fix potential duplicate entries in Merge part tables #922 ### Pipelines