Add default replacement keys parameter for insert and upsert methods#375
Add default replacement keys parameter for insert and upsert methods#375dshepelev15 wants to merge 2 commits intopudo:masterfrom
Conversation
|
This is both an interesting idea and a really nicely done PR. One thing that I'm concerned about is making this less of a usability risk. The current implementation would probably just overwrite the entire table if no unique constraint is defined. That should be an exception, probably. But I kind of wonder if an even cleaner solution would be to make the unique behaviour opt-in, perhaps via some magic value? Or we could expose the unique keys as a property on table? if len(table.unique_columns):
table.upsert(data, table.unique_columns)This is just a bit more explicit and might avoid users overwriting databases when they misunderstand the API (Note: we probably want to warn on len 0 |
|
Thank you for your comments. |
|
Thanks for making these adaptations! I just meant that always passing the |
|
I've got your concern. Let's add the ability to pass a parameter (for instance I am also thinking about usage of primary keys here instead of unique keys. Whad do you think about that? I saw the ticket about |
Hi!
I've implemented the ability to use default values of the
keysparameter forinsert*&upsert*methods.This task is related with suggestion
Can you please check the code?