Define task name dynamically

Hi there,

I’m trying to define a dynamic name for my tasks, but i can’t figure out how. I want to have the exact table name in the task name.

I tried this, but with no luck:

def trigger_data_load(table: str):
    url = f"https://importerurl?table={table}"

    headers = {"Authorization": f"bearer {get_creds_token(url)}"}"Starting to extract data from {table}")
    ret = requests.get(

    if ret.status_code != 200 and ret.status_code != 201:
        logger.warn(f"API response {ret.text}")
        raise Exception(ret.text)

    return ret

with Flow(
    schedule=CronSchedule("0 1 * * *","Europe/Berlin")),
) as f:

    for table in tables:

I saw a documentation entry for defining run_names though…

1 Like

we had an open GitHub issue for this for flow run names Allow setting a custom flow run name · Issue #5968 · PrefectHQ/prefect · GitHub

do you want to open a feature request on GitHub and explain there why adding such functionality is important for your use case?