prom icon indicating copy to clipboard operation
prom copied to clipboard

save() when you set the primary key

Open Jaymon opened this issue 3 years ago • 1 comments

It's become a common workflow for me to set the primary key, and so I've had to change multiple orm's to do something like this:

from prom.exception import UniqueError

def save(self):
    try:
        super(Foo, self).save()
    except UniqueError:
        self.update()

I think .save() should probably just automatically do this, and for the times I want specific error handling I can call .insert() or .update() manually.

Jaymon avatar Aug 24 '20 23:08 Jaymon