https://prefect.io logo
Title
a

Aaron Gonzalez

02/24/2023, 12:43 PM
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
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

Wellington Braga

02/24/2023, 2:33 PM
@task(
    name="name_task",
    task_run_name="name_runned_task",
)
or:
my_task = bigquery_query
my_task.name = "name_task"

await myt_task(load_query, creds)
r

Ryan Peden

02/24/2023, 2:52 PM
I think
with_options
is what you're looking for if you want to change the name of a single task run. For example:
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

Aaron Gonzalez

02/24/2023, 4:41 PM
😮h-yeah:
Thanks @Ryan Peden @Wellington Braga!
:oh-yeah: 1