prom icon indicating copy to clipboard operation
prom copied to clipboard

save() when you set the primary key

Open Jaymon opened this issue 5 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

https://github.com/Jaymon/prom/issues/119

Jaymon avatar Oct 16 '21 06:10 Jaymon

I think this is handled by Orm.upsert

Jaymon avatar Mar 21 '23 23:03 Jaymon