-
Notifications
You must be signed in to change notification settings - Fork 93
Description
Feature Request
Allow new ways of handling different types of duplicates in insert1
Problem
Currently, there is only one way to skip inserts skip_duplicates=True ignores all duplicates, including primary key or secondary unique indexes. There are cases, however, when only specific types of duplicates should be skipped.
Requirements
Condition 1. For a primary duplicate, we need an option to ignore the duplicate only if the entry matches on all the secondary unique indexes. This is helpful for tables that map unique indexes between two identification systems.
Condition 2. For a secondary duplicate, it may be helpful to include in the error message the primary key of the duplicate entry already in the database.
Both conditions will require a second query and only apply to insert1 rather than insert.
This could be addressed by allowing other values besides True or False for the skip_duplicates argument in insert1. Considering that both conditions should probably appear together, we can name this option "match":
table.insert1(entry, skip_duplicates='match')Alternative Considerations
This feature was discussed for addressing: datajoint/element-interface#42
Potentially, we could implement this feature in element-interface as a general datajoint utility but not part of datajoint itself. This depends on how clear and common the functionality is.