Coming back to this question with a more fleshed o...
# spicedb
t
Coming back to this question with a more fleshed out need for a remote transaction API: I'm trying desperately to use SpiceDB synchronously (i.e. write updates, wait for their completion, use the results of my writes in subsequent operations). This isn't because I think it's the best or most robust way, it's just the way my organization has been using postgres for a long time, and an outbox pattern would require changing a lot more code and people's mental models of code flow. Unfortunately, without a transaction API, SpiceDB is hard to use as a relationship database. Something as simple as this fails ACID compliance:
Copy code
spice.write(relationship1)
spice.write(relationship2)
If the second write fails (perhaps we poorly managed resources and SpiceDB hit an OOM), the first write leaves the DB in an inconsistent state. Yes, I could combine those into one atomic
WriteRelationships
, if they were part of the same function or code block. If there's any reason they need to be spread out (which happens pretty often), my code is no longer robust. That's also the case if I mix
WriteRelationships
and
DeleteRelationships
. Maybe django/postgres has spoiled me, but I think it's hard to see SpiceDB as a true DB without reliable ACID transactions:
Copy code
with db.transaction():
    spice.write(relationship1)
    # ... lots of stuff that could fail here ...
    spice.write(relationship2)
    # transaction commits here
6 Views