Hi all, I'm triggering my flow with AWS lambda and...
# ask-community
m
Hi all, I'm triggering my flow with AWS lambda and this great example answered most of my questions: https://github.com/cicdw/prefect-cloud-lambda . But I'm just wondering, is there an easy way to get latest flow_id for my flow_group, rather than hardcoding flow_id in there (and changing every time I deploy a new version)? Is there another env var I can specify maybe?
b
Depends on what you want to identify the flow by I guess. We trigger a flow from a lambda by name, getting the flow id with something like:
Copy code
prefect_client.graphql("""
        {
            flow(where: {_and: {
                archived: {_eq: false},
                name: {_eq: "%s"},
            }}){
                id
                flow_group {
                    id
                }
            }
        }
      """ % flow_name)
This works because there can be only 1 unarchived version of a flow with a name
🙌 1
k
This is a good solution that you can query for the flow by name where archived is false.
🙏 1
m
That’s great! Thanks a lot!