Hi Why does this GQL query return "empty results"?...
# ask-community
s
Hi Why does this GQL query return "empty results"? I expect there to be only one, since the query filters the flow runs by id?
Copy code
query {
  flow(where: { name: { _ilike: "Energy Insight" } }) {
    flow_runs(where: {name: {_eq: "stalwart-ostrich"}}) {
      name
      id
    } 
  }
->
Copy code
{
  "data": {
    "flow": [
      {
        "flow_runs": []
      },
      {
        "flow_runs": []
      },
      {
        "flow_runs": []
      },
      {
        "flow_runs": []
      },
      {
        "flow_runs": []
      },
      {
        "flow_runs": [
          {
            "name": "stalwart-ostrich",
            "id": "8bca3ab2-05cc-4223-93f0-071813528545"
          }
        ]
      }
    ]
  }
}
I see the key is in the name being flow_run_*s*_ This query does return only one:
Copy code
query {
  flow_run(where: {name: {_eq: "stalwart-ostrich"}}){
    name
    id
  }
}
But it still feels strange to me that the former returns those empty ones even if they didn't have a matching ID?
k
I think that is because your first flow query returns previous versions of the Flow as well. You can set
archived=False
to only get the latest one. And then those previous versions don’t have any flow runs with matching names
🙌 1