You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have many situations where I want to read many relationships, but ReadRelationships restricts me to reading them one at a time. Most prohibitively, this happens when I want to read a relationship for every item in a list response.
If I have a length n list of documents alone, such as ["document:DocumentA", "document:DocumentB", "document:DocumentC"], I have to make n SpiceDB ReadRelationships requests to fill out those namespaces. Each request would be of this form:
Once I have the list of parent folders, there does exist a CheckBulkPermissions API, where I can check access to each element in the list using one request, which is great. I would love to read the initial relationships in one request as well.
Solution Brainstorm
A ReadBulkRelationships API akin to the CheckBulkPermissions API would be excellent.
For the example I mentioned above, the desired relationships are somewhat "homogeneous": we're reading the same relation for the same definition type, with only the IDs differing. You can imagine a variant of RelationshipFilter that accepts a list of optional_resource_ids for just this purpose, though I haven't fully thought this interface through. This can definitely be optimized in the SQL to avoid n separate queries. This interface is most useful for me and seems to benefit the most from such an interface.
In general, a user might want "heterogeneous" calls: a list of completely disparate RelationshipFilters to be returned in one response. SpiceDB would return a relationship if it matched any of the given filters. This might not benefit as much at the database query level, but it would certainly benefit from reduced network overhead. I would utilize this in performance-sensitive areas of my app.
Thanks for your time!
The text was updated successfully, but these errors were encountered:
Problem Statement
I have many situations where I want to read many relationships, but
ReadRelationships
restricts me to reading them one at a time. Most prohibitively, this happens when I want to read a relationship for every item in a list response.Consider this schema:
Let's say my API wants to send a user a specific list of documents, with the namespace (in this case, just the name of the parent folder) included:
If I have a length
n
list of documents alone, such as["document:DocumentA", "document:DocumentB", "document:DocumentC"]
, I have to maken
SpiceDBReadRelationships
requests to fill out those namespaces. Each request would be of this form:Once I have the list of parent folders, there does exist a
CheckBulkPermissions
API, where I can check access to each element in the list using one request, which is great. I would love to read the initial relationships in one request as well.Solution Brainstorm
A
ReadBulkRelationships
API akin to theCheckBulkPermissions
API would be excellent.For the example I mentioned above, the desired relationships are somewhat "homogeneous": we're reading the same relation for the same definition type, with only the IDs differing. You can imagine a variant of
RelationshipFilter
that accepts a list ofoptional_resource_id
s for just this purpose, though I haven't fully thought this interface through. This can definitely be optimized in the SQL to avoidn
separate queries. This interface is most useful for me and seems to benefit the most from such an interface.In general, a user might want "heterogeneous" calls: a list of completely disparate
RelationshipFilter
s to be returned in one response. SpiceDB would return a relationship if it matched any of the given filters. This might not benefit as much at the database query level, but it would certainly benefit from reduced network overhead. I would utilize this in performance-sensitive areas of my app.Thanks for your time!
The text was updated successfully, but these errors were encountered: