Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for entry in merge part table prior to insert #922

Merged
merged 2 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions src/spyglass/utils/dj_merge_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
Loading