I have some data structures that look like this:<p>Car:<p><pre><code> Seats: [{ID: frontSeatId}, {ID: backSeatId}]
Driver: {'Name':'Joe', 'SalaryUSD': 42000}
SoundSystem:
{'TypeID': androidAutoId, Protocols: [{ID: radioProtocolId}, {ID: bluetoothProtocolId}]}
</code></pre>
In this system, we often need to do partial updates, like:<p>Car:<p><pre><code> Driver: {'Name': 'Jack'}
SoundSystem:
{Protocols: [{ID: bluetoothProtocolId}]}
</code></pre>
Meaning that the SoundSystemProtocols table should delete and create new entries such that the car only supports bluetooth, and the driver should get renamed from Joe to Jack.<p>Is there an ORM that lets you do these partial updates atomically, without writing custom controllers for each Car-like object?<p>I want ergonomics over performance. I don't mind the language. Ideally it should allow a simple interface where the model defines the controller.<p>I've tried SQLModel, which promises this, but ended up with confusing JSON validation, mixing between SQLModel types and the internal SQLAlchemy model, and still had to write session.add(seats) by hand anyway.<p>If this doesn't exist for SQL, does another database support ID-as-value like this, where passing in an ID changes a reference, and passing in a value changes the value at that reference?