Chung
08/21/2025, 12:36 AM// add members to groups
usergroup:1#direct_member@user:2
usergroup:2#direct_member@user:2
usergroup:3#direct_member@user:2
How do I delete the relatinships for user 2 via the protobuf API? In SQL term, that is
sql
DELETE from relation_tuple where namespace='usergroup' and userset_namespace='user' and userset_object_id='2' and relation='direct_member';
I tried the following but nothing happened in the database level, hwoever, the reponse DID show `relationships_deleted_count: 5`; On subsequet call, it changed to relationships_deleted_count: 0.
rs
DeleteRelationshipsRequest {
relationship_filter: Some(
RelationshipFilter {
resource_type: "usergroup",
optional_resource_id: "",
optional_resource_id_prefix: "",
optional_relation: "direct_member",
optional_subject_filter: Some(
SubjectFilter {
subject_type: "user",
optional_subject_id: "2",
optional_relation: None,
},
),
},
),
optional_preconditions: [],
optional_limit: 0,
optional_allow_partial_deletions: false,
optional_transaction_metadata: None,
}
Response {
metadata: MetadataMap {
headers: {
"content-type": "application/grpc",
"io.spicedb.respmeta.requestid": "d2j6humih8mvljat2djg",
"grpc-status": "0",
"grpc-message": "",
"io.spicedb.respmeta.dispatchedoperationscount": "1",
"io.spicedb.respmeta.cachedoperationscount": "0",
},
},
message: DeleteRelationshipsResponse {
deleted_at: Some(
ZedToken {
token: "GgoKCENKNmVBZz09",
},
),
deletion_progress: Complete,
relationships_deleted_count: 5,
},
extensions: Extensions,
}