Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save justinnaldzin/1e4b65bed7548fb74aca1c44a0d5e16f to your computer and use it in GitHub Desktop.
Save justinnaldzin/1e4b65bed7548fb74aca1c44a0d5e16f to your computer and use it in GitHub Desktop.
Delete all tables within a BigQuery dataset
# Delete all tables within a BigQuery dataset
from google.cloud import bigquery
bigquery_client = bigquery.Client()
bq_dataset = 'my_dataset'
dataset_ref = bigquery_client.dataset(bq_dataset)
tables = list(bigquery_client.list_dataset_tables(dataset_ref))
for table in tables:
bigquery_client.delete_table(table)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment