Hello. Is there a Python API to get the flow versi...
# prefect-community
m
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?
discourse 1
k
k
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
Copy code
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"])
m
You mean that number that just increases right?
Yes, okay I’ll use that. Thanks!