How to query (and filter for) flow runs with a specific flow version group ID?

View in #prefect-community on Slack

Ken_Nguyen @Ken_Nguyen: Is there a way I can use version_group_id instead of flow_id in my GQL query? I tried to simply swap out flow_id for version_group_id, but that’s giving me the following error

Kevin_Kho @Kevin_Kho: What is the original query here?

Ken_Nguyen @Ken_Nguyen: Silly me providing no context again, here it is:

query {
  flow_run (
    where: {flow_id: {_eq: "[FLOW_ID]"}}
    order_by: {state_timestamp: desc}
    limit: 1
    offset: 0
  ){
    name
    flow_id
    flow {
      name
      id
    }
    logs {
      message
      created
    }
  }
}

Also some follow up questions:

  1. What is the difference between Flow Group ID and Version Group ID? I see that Flow ID changes between different versions, but both of the other ones have remained the same.
  2. Is it safe to share flow ids publicly?

Kevin_Kho @Kevin_Kho: Flow group ID is just for backward compatibility.
Yes it actually is

Ken_Nguyen @Ken_Nguyen: Good to know!

Kevin_Kho @Kevin_Kho:

query {
  flow_run (
    where: {flow: {version_group_id: {_eq: "e49fde24-f2b0-4b7d-a653-fabcd774ac67"}}}
    order_by: {state_timestamp: desc}
    limit: 1
    offset: 0
  ){
    name
    flow_id
    flow{
      name
      id
      version_group_id
    }
    logs {
      message
      created
    }
  }
}

Ken_Nguyen @Ken_Nguyen: Amazing, that works great! I tried looking for documentation for things like this but couldn’t find any, did I overlook anywhere?

Kevin_Kho @Kevin_Kho: No….unless you wanna a GraphQL tutorial. I thought Hasura had one but I can’t find it now. I haven’t read any though, I think you just kinda pick it up. Sometimes though, I check the UI repo and see how a certain frontend page queries the backend

GitHub: ui/src/graphql at master · PrefectHQ/ui

Ken_Nguyen @Ken_Nguyen: Good idea