Skip to content

docs: include the clean-up step in the udf code snippet #1698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions samples/snippets/udf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]