Open navigation

How to delete multiple BigQuery tables

This guide will walk you through how to delete multiple BigQuery tables using a wildcard. This solution was provided by Henry Munro at Stack Overflow


  1. Copy this code:
    select concat("bq rm -f -t ",table_schema,".",   table_name, ";" )
    from <insert_your_dataset_name>.INFORMATION_SCHEMA.TABLES
    where table_name like "INSERT_YOUR_TABLE_NAME_%"
    order by table_name desc

  2. Open BigQuery. Paste in the copied code.

  3. Replace <insert_your_dataset_name> with your dataset name. In this example, we’ve used “Supermetrics”.

  4. Replace INSERT_YOUR_TABLE_NAME_% with your table name. Here, we’ve used "GA_GA_V1".

  5. Click Run.
  6. Near the bottom of the screen, click Save results. This will open the Save Query Results dialog box.
  7. Select Google Sheets from the dropdown menu.
  8. Click Save.
  9. Open your file in Google Sheets, and copy the query from it.

  10. Paste it into BigQuery.

  11. Make sure to add /* at both the beginning and the end of the code.

Once you've commented out the original code, run the query and it'll remove your tables.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.