Jaymon / prom

A PostgreSQL or SQLite orm for Python
MIT License
22 stars 4 forks source link

Primary key setting with partial information and then saving #178

Open Jaymon opened 6 months ago

Jaymon commented 6 months ago

This is something I need to check on to see what prom does, say I do something like this:

f = Foo(pk="<UUID>", bar="some value")
await f.save()

What does that do if there is already a row with a matching pk? Let's say Foo had 6 fields, does it blow those out with None or default values?

I think it should look at the primary key field and decide if it is a key that can be set, if it isn't it (ie it's an auto-set UUID or counting field) then it should treat the pk as belonging to an existing row and set the appropriate plumbing to do an update when .save() is called.