https://prefect.io logo
Title
k

Kai Weber

06/23/2020, 5:59 AM
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

nicholas

06/23/2020, 6:28 AM
Hi @Kai Weber - you'll want to use something like this:
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

Kai Weber

06/23/2020, 7:14 AM
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

nicholas

06/23/2020, 7:26 AM
@Kai Weber curious why you're using
insert_flow_run
instead of
create_flow_run
?
k

Kai Weber

06/23/2020, 7:27 AM
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

nicholas

06/23/2020, 7:29 AM
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

Kai Weber

06/23/2020, 7:33 AM
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

nicholas

06/23/2020, 7:34 AM
Got it. I'd recommend using the InteractiveAPI in the UI instead, that'll give you lookahead and documentation
k

Kai Weber

06/23/2020, 7:47 AM
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

nicholas

06/23/2020, 4:21 PM
Great to hear!