gramex icon indicating copy to clipboard operation
gramex copied to clipboard

gramex.data.insert should support UPSERT

Open kriti21 opened this issue 5 years ago • 3 comments

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 avatar Mar 12 '19 09:03 kriti21

@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 avatar Apr 01 '19 00:04 sanand0

@sanand0 Bumping this up. When can we plan to do this?

jaidevd avatar Jul 17 '20 06:07 jaidevd

Having researched approaches, the easiest is to apply this simple logic.

No timeline yet, but there is a clear need for this.

sanand0 avatar Mar 21 '21 02:03 sanand0