diff --git a/samples/snippets/udf.py b/samples/snippets/udf.py index 495cd33e84..5f7ad8a33f 100644 --- a/samples/snippets/udf.py +++ b/samples/snippets/udf.py @@ -112,10 +112,9 @@ def get_hash(input: str) -> str: df_redacted = df[["species", "island", "sex"]].map(get_hash) df_redacted.peek(10) - # [END bigquery_dataframes_udf] - - # Clean up cloud artifacts + # If the BigQuery routine is no longer needed, we can clean it up + # to free up any cloud quota session = bpd.get_global_session() - session.bqclient.delete_routine( - f"{your_bq_dataset_id}.{your_bq_routine_id}", not_found_ok=True - ) + session.bqclient.delete_routine(f"{your_bq_dataset_id}.{your_bq_routine_id}") + + # [END bigquery_dataframes_udf]