https://prefect.io logo
Title
c

Christopher Chong Tau Teng

01/21/2022, 2:41 AM
Hi there, apart from GUI, how do I remove/delete one/multiple flows? e.g. via CLI, Python etc.
k

Kevin Kho

01/21/2022, 2:44 AM
You need to use the GraphQL API like:
mutation {
  delete_flow(input:{flow_id: "171bb895-f94e-4d9d-9e86-7370b743a285"}) {
    success
  }
}
c

Christopher Chong Tau Teng

01/21/2022, 6:43 AM
@Kevin Kho apart from GraphQL, is there any other way? specifically way that can be scripted
I saw that we can use Python script to interact with GraphQL https://docs.prefect.io/orchestration/concepts/api.html#client, is there a way to delete flow just by specifying its name but not its id?
a

Anna Geller

01/21/2022, 11:41 AM
You could first query for flows and their IDs, and use it as input to the delete_flow mutation. You can definitely script that in Python but there is no way to bulk delete things from the CLI or UI, other than perhaps delete an entire project and all flows within a project.
c

Christopher Chong Tau Teng

01/24/2022, 4:06 AM
@Anna Geller so there re no CLI way to delete flow?
k

Kevin Kho

01/24/2022, 4:11 AM
There is none. Just projects. We’d definitely welcome a PR for that though