gramex
gramex copied to clipboard
gramex.data.insert should support UPSERT
In case when unique constraint is defined on a column, gramex.data.insert
breaks for the entire data even if there is only one duplicate row. It would be better if it can ignore the duplicate rows and insert rest of them without failing.
@kriti21 This could be dangerous.
- Suppose I have 10 employees, each with a unique email ID.
- The user edits one record and inserts a new record. We send a single
gramex.data.insert
to push both entries - Today, the system will raise an error, and the developer will know it breaks
- But If it ignores the duplicate entry, the edit will be lost and the developer & user may not catch this.
What you're asking for, I think, is the UPSERT feature. This can be implemented as an option to gramex.data.update(insert=True)
, perhaps.
This has come up a few times. I propose we take this up @mankoven
@sanand0 Bumping this up. When can we plan to do this?
Having researched approaches, the easiest is to apply this simple logic.
No timeline yet, but there is a clear need for this.