Hey! How can i use GraphQL mutation to delete pre...
# ask-community
d
Hey! How can i use GraphQL mutation to delete prefect flow run logs by flow run id? an example would be appreciated!
a
You can do it this way:
Copy code
from prefect import Client

flow_run_id = "paste UUID here"
client = Client()
client.graphql(
    {
        "mutation": {
            'delete_flow_run(input: {flow_run_id: "'
            + flow_run_id
            + '"})': {"success", "error"}
        }
    }
)
And if you need it to clean up space in Prefect Server database, check out this thread
d
Thank you. i did that and deleted a lot of flow runs but it seems like the storage is unchanged [even grew a bit]
any idea what it could be?
a
Nope, it shouldn't. But you can also check this thread if you want to save Postgres space for Server