I don't have any experience with GraphQL so I'm st...
# ask-community
j
I don't have any experience with GraphQL so I'm struggling to format my query. How would I get a count of running/submitted flow runs for a specific flow name? I'm a django orm user, so I know it would look this:
Copy code
nruns = FlowRuns.objects.filter(flow__name="MyExampleFlow", state__in=["Running", "Submitted"]).count()
But for graphql... I'm kinda lost. And how would I format this in python for the
client.query()
method?
k
This is the source for what the UI uses
j
awesome thanks!
Copy code
query FlowRuns($flow_run_name: "MyExampleFlow",) {
  Success: flow_run_aggregate(
    where: {
      flow: { name: { _eq: $flow_run_name }}
      state: { _eq: "Success" }
    }
  ) {
    aggregate {
      count
    }
  }
so would it look something like this? I'm getting errors but honestly have no idea what's wrong
Actually nevermind. I think I'm getting the hang of it. My query is:
Copy code
query {
  flow_run_aggregate (where: 
    {flow: {name:{_eq: "MyExampleFlow"}}
    state: { _in: ["Success", "Pending"] }
    })
     {
      aggregate {count}
    }
}
k
That looks good. I was expecting you to just use the flow id but this looks like it works