Skip to content
This repository

Add new function replace_batch() #1652

Closed
Dentxinho opened this Issue · 7 comments

2 participants

Raul Baldner Junior Andrey Andreev
Raul Baldner Junior

We have the functions insert_batch() and update_batch(), but no replace_batch() is provided.
Can replace_batch() be created?

Andrey Andreev
Collaborator
narfbg commented

If you can and want to do it - submit a pull request, but I don't really see many use-cases for this functionality, if any.

Raul Baldner Junior

@narfbg I want to do this, but I need to find some time.
And I could tell you a number of use-cases :)

Andrey Andreev
Collaborator
narfbg commented

Since you've requested it - I'm sure you could, from your point of view. But apparently, so far it's only you that needs such a functionality and your reasoning so far is "Since there's insert_batch() and update_batch(), why no replace_batch()". That doesn't sound like a popular feature request. :)

Would be included if you suggest a proper implementation though, I'm not trying to discourage you. :)

Raul Baldner Junior

Ok...
A fair reason for replace_batch() is because you won't need to make a delete() >> insert_batch(), or an update_batch() on existent items and insert_batch() on new ones

Andrey Andreev
Collaborator
narfbg commented

... that would be the whole point, of course. The REPLACE clause wouldn't exist otherwise. But who does both insert_batch() and update_batch() at the same time? :)

Raul Baldner Junior

Just to clarify:
I have a form like this:

entities ___________ config1 ____________ config2
entity1             [        ]           [        ]
entity2             [        ]           [        ]
entity3             [        ]           [        ]

When submitting this form, I can make an insert_batch().

New entities can be added (on another form, by another user) and "configs" can be updated. So... users can change existent entities' "configs" while setting the new entities' "configs". To do this: insert_batch() and update_batch() OR delete() >>> insert_batch().

Raul Baldner Junior

ooops

I wanted to start working on it, but it needs to be added on every single db driver.
I can't do this, sorry...

Andrey Andreev narfbg closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.