👋 Hello again folks! I'm wondering if
# spicedb
p
👋 Hello again folks! I'm wondering if there's a way of doing... transitive deletes (?) in spicedb. I don't really know how to call them, but the idea would be: SAy we have users and documents
Copy code
definition user {}
definition document {
  relation owner: user
  relation participant: user
}
I'd like to delete all
document:$docId#participant@user:$anyUser
relations where
document:$docId#owner@user:user1
exists. I'm thinking if preconditions is something that can help me but I'm not 100% sure :/
Currently I'm implementing it as querying all docs that the user owns, and sending a deletebatch per document, but I'd like to batch it even further to avoid the N+1 queries (N=num docs)
y
currently the read-then-delete that you're doing is the best way to do it. we don't have a notion of cascading deletes (which i think is what you're getting at? lemme know if i've misinterpreted) you can theoretically batch the deletes further, as long as the number of relationships fits within the write transaction maximum
p
ah, I see, thx @yetitwo
y
sure thing!
5 Views