Is it possible to pass in custom task name to each...
# ask-community
a
Is it possible to pass in custom task name to each of the calls to
bigquery_query
here. Not that big of a deal but I just would prefer to see something a little more descriptive. https://prefecthq.github.io/prefect-gcp/bigquery/#prefect_gcp.bigquery.bigquery_query
Copy code
if await bigquery_query(
        exists_query,
        creds
    ):
        print(f"Deleting data from the {sync_date} partition.")
        await bigquery_query(
            del_query,
            creds
        )

    await bigquery_query(
        load_query,
        creds
    )
1
w
Copy code
@task(
    name="name_task",
    task_run_name="name_runned_task",
)
or:
Copy code
my_task = bigquery_query
my_task.name = "name_task"

await myt_task(load_query, creds)
r
I think
with_options
is what you're looking for if you want to change the name of a single task run. For example:
Copy code
exists_task = bigquery_query.with_options(name="check existence")
delete_task = bigquery_query.with_options(name="delete data")
load_task = bigquery_query.with_options(name="load data")

if await exists_task(exists_query, creds):
    print(f"Deleting data from the {sync_date} partition.")
    await delete_task(del_query, creds)

await load_task(load_query, creds)
a
🎉
Thanks @Ryan Peden @Wellington Braga!
🎉 1