Hi, I am trying to run a flow given its name and p...
# ask-community
f
Hi, I am trying to run a flow given its name and project. Since the client can only do this given an ID I was trying to find the ID via graphql. However I fail to construct a proper query to only find the active version of the flow.
Copy code
{
  flow_group(
    where: {flows: {name: {_ilike: "%name%"}, archived: {_eq:false}}}  ) {
    id
    name
    flows{
      name
      id
      archived
    }
  }
}
Will not actually filter for not archived versions. What am I doing wrong?
a
Have you tried just using the
create_flow_run
Prefect task?
Copy code
from prefect.tasks.prefect import create_flow_run

with Flow() as flow:
    create_flow_run(flow_name="xx", project_name="yy")
f
We have tried this in other places and it works great, but we were looking add a trigger to an internal dashboard for certain flows and it did not seem appropriate to create a flow in that case. But I guess I could just use the run() mehthod of the task instead.
a
in that case you can grab the version group ID from the UI and use it e.g. with requests as shown here
🙌 1
f
Thank you!