<@U04UQ68083H>, how can we create predefine tupple...
# ory-copilot
p
@chilly-king-10285, how can we create predefine tupples when build is up for keto?
c
A message from kapa.ai
You can create predefined tuples for Ory Keto using the Ory CLI. Here's an example of how you can do this: First, define your tuples in a JSON file. For instance, you can create a
relationships.json
file with your predefined tuples. The content of this file should follow the structure of a RelationTuple, which defines a relation between an Object and a Subject. More details about the RelationTuple structure can be found [here](https://www.ory.sh/docs/keto/reference/proto-api#relationtuple). Once you have your
relationships.json
file ready, you can use the Ory CLI to create these relationships in Ory Keto. Here's the command you can use:
Copy code
bash ory create relationships relationships.json
This command will create the relationships defined in your
relationships.json
file in Ory Keto. You can find more details about managing relation tuples using Ory CLI [here](https://www.ory.sh/docs/guides/cli/configure-permission-service#manage-relation-tuples). Please note that to run these operations, you must provide the ID of the project in which you want to manage the tuples using the
--project
flag. For convenience, you can export the ID of your project as an environment variable and use the variable with the
--project
flag instead of passing the project ID directly in the command. Here's an example of how you can do this:
Copy code
bash ## List all available projects   ory list projects      ## Export project ID as env. variable   export PROJECT=<ory-project-id>
Then you can use the
PROJECT
environment variable in your command:
Copy code
bash ory create relationships --project=$PROJECT relationships.json
This will create the relationships in the specified project.
h
@chilly-king-10285 yes i have tried but unsuccessful
keto relation-tuple create file_access.json -c config/relation_tuples --write-remote KETO_WRITE_REMOTE=keto:4467
Error: context deadline exceeded Usage: keto relation-tuple create <relationships.json> [<relationships-dir>] [flags] Flags: --authority string Set the authority header for the remote gRPC server. --format string Set the output format. One of table, json, yaml, json-pretty, jsonpath and jsonpointer. (default "default") -h, --help help for create --insecure-disable-transport-security Disables transport security. Do not use this in production. --insecure-skip-hostname-verification Disables hostname verification. Do not use this in production. -q, --quiet Be quiet with output printing. --read-remote string Remote address of the read API endpoint. (default "127.0.0.1:4466") --write-remote string Remote address of the write API endpoint. (default "127.0.0.1:4467") Global Flags: -c, --config strings Config files to load, overwriting in the order specified. (default [C:\Users\HarjotSingh\keto.yml]) context deadline exceeded