Matthew Roeschke

    Matthew Roeschke

    5 months ago
    Hello. Is there a Python API to get the flow version given a flow name? Or is flow version only accessible via the
    prefect get flows
    cli command?
    Kyle McChesney

    Kyle McChesney

    5 months ago
    Kevin Kho

    Kevin Kho

    5 months ago
    I am not sure any of those actually hold the flow version. You mean that number that just increases right? I think you need to hit the GraphQL API with
    client.graphql
    to retrieve it
    from prefect.client import Client 
    
    client = Client()
    query="""
    query {
      flow(where: {name: {_eq: "schedule_test"}, archived: {_eq: false}}) {
        name
        project{
          name
        }
        version
        archived
      }
    }
    """
    print(client.graphql(query)["data"]["flow"][0]["version"])
    Matthew Roeschke

    Matthew Roeschke

    5 months ago
    You mean that number that just increases right?
    Yes, okay I’ll use that. Thanks!