Hi can anybody give me a hint what the GraphQL que...
# prefect-community
k
Hi can anybody give me a hint what the GraphQL query in HASURA to start my flow "Hello World" has to look like? This query shows my flows: query MyQuery { flow(distinct_on: name) { name id description } }
n
Hi @Kai Weber - you'll want to use something like this:
Copy code
mutation {
  create_flow_run(input: {flow_id: "hello_world_flow_group_id"}) {
    id
  }
}
replacing the
hello_world_flow_group_id
with the
flow_group_id
returned by your first query (you can add
flow_group_id
to the body of that query). You can also use the
flow_id
to target that specific version of your flow.
k
Hi Nicolas, super! After a while of testing I got something running. But I need to get the idea what actually happens. This is my code: mutation { insert_flow_run(objects: {flow_id: "94260671-b1c8-4201-9056-b4994a5cfd78"}) { returning { duration start_time id } } }
This is the reaction: { "data": { "insert_flow_run": { "returning": [ { "duration": null, "start_time": null, "id": "7cfbcdd0-c05c-4396-9340-e2438e1083ad" } ] } } }
n
@Kai Weber curious why you're using
insert_flow_run
instead of
create_flow_run
?
k
Because HASURA tells me that there is no command create_flow_run: { "errors": [ { "extensions": { "path": "$.selectionSet.create_flow_run", "code": "validation-failed" }, "message": "field \"create_flow_run\" not found in type: 'mutation_root'" } ] }
n
Hm, that's odd but I'm not a Hasura expert so not sure why that would be. Why are you running these from Hasura?
I think running anything from the Hasura console may interact directly with the db and so will bypass the API entirely... ( I could be wrong but that would explain the behavior you're seeing )
k
Actually I am looking to use the API out of Node Red. NR has a GraphQL package and I use Hasura to check if the code would work.
n
Got it. I'd recommend using the InteractiveAPI in the UI instead, that'll give you lookahead and documentation
k
Ok I will check that out! Thanks!
👍 1
Just for info 🙂. It is working! I don't use Hasura anymore! Thanks for your help 👍
n
Great to hear!