https://prefect.io logo
Title
j

Jeff Brainerd

03/26/2020, 6:43 PM
Hi folks, quick API question — in this query I can grab a particular parameter (awesome) but would love to be able to filter on a particular value, e.g. “company_slug=acmecorp” — is this possible today? Thanks 🙏
query {
  flow_run {
    name
    parameters(path: "company_slug")
  }
}
k

Kyle Moon-Wright

03/26/2020, 6:55 PM
Hey Jeff! You can definitely filter your query to a particular value, it would probably look something like this:
query {
  flow_run(where: {parameters: {_contains: "table"}}) {
    id
    name
  }
}
:upvote: 1
j

Jeff Brainerd

03/26/2020, 7:17 PM
Thanks Kyle! I think I am close… I can create a query like that (substituting “table” for a value I know exists) and the query is syntactically correct but does not bring back any flow runs (even though I know some exist). I might not be understanding what “_contains” actually does — the help is almost helpful but I can’t actually see what is says… anyway I’ll keep digging, thanks again.
k

Kyle Moon-Wright

03/26/2020, 7:19 PM
j

Jeff Brainerd

03/26/2020, 7:20 PM
ah, got it, yes thank you!
Just to close the loop, here’s the final query:
query {
          flow_run(where: {
            _and: {
                flow: {
                    name: { _eq: "jf_data_pipeline" }
                    version_group_id: { _eq: "staging"},
                    archived: { _eq: false }     
                  }
                state: { _eq: "Running" },
                parameters: { _contains: { company_slug: "acmecorp" } },
            }
          }) {
            flow_id
            state
          }
        }
Loving the GraphQL API!
👍 1
k

Kyle Moon-Wright

03/26/2020, 8:20 PM
Nice!