Hi gurus another question here RE read


03/16/2023, 2:59 AM
Hi gurus, another question here RE 'read relationships' - given some 'organisation' O, and a set of distinct resources P, Q, R and S, is it possible to determine which P, Q, R or S has a relationship to O without checking directly on the P, Q, R and S definitions? Be so useful to be able to simply do a
zed relationship read subject=organisation:id


03/16/2023, 11:06 AM
read relationships API method as a optional relationship filter argument: it would allow you to read and filter by subject type and subject id
zed command allows you to specify it:
  zed relationship read <resource_type:optional_resource_id> <optional_relation> <optional_subject_type:optional_subject_id#optional_subject_relation> [flags]

      --consistency-at-exactly string   evaluate at the provided zedtoken
      --consistency-at-least string     evaluate at least as consistent as the provided zedtoken
      --consistency-full                evaluate at the newest zedtoken in the database
      --consistency-min-latency         evaluate at the zedtoken preferred by the database
  -h, --help                            help for read
      --json                            output as JSON
      --subject-filter string           optional subject filter

Global Flags:
      --certificate-path string     path to certificate authoriy used to verify secure connections
      --endpoint string             spicedb gRPC API endpoint
      --insecure                    connect over a plaintext connection
      --log-format string           format of logs ("auto", "console", "json") (default "auto")
      --log-level string            verbosity of logging ("trace", "debug", "info", "warn", "error") (default "info")
      --no-verify-ca                do not attempt to verify the server's certificate chain and host name
      --permissions-system string   permissions system to query
      --skip-version-check          if true, no version check is performed against the server
      --token string                token used to authenticate to SpiceDB


03/16/2023, 11:39 PM
I'll give this a go - thanks for pointing that out!!
OK - if I'm reading it right, I still can't do what I want, BUT, if I am willing to walk the types I expect should be related to that item, I can achieve it with multiple queries. Not perfect, but better than nothing. I might go see if someone has requested this feature already somewhere...
(problem is that relationship read requires at least one positional arg of a defined type)