0
votes

Would like to delete data from multiple tables in bigquery.

Below delete syntax is working to delete single table without Union all or wildcard

delete  FROM `abc.analytics_151541058.events_20190201` WHERE event_date='20190201'

Below delete query with Union all did not worked

delete  FROM `abc.analytics_151541058.events_20190201` WHERE event_date='20190201'
UNION ALL 
delete  FROM `abc.analytics_151541058.events_20190201` WHERE event_date='20190202'

Below delete query with wildcard did not worked

delete  FROM `abc.analytics_151541058.events_*`,  
WHERE _TABLE_SUFFIX BETWEEN '20190201' AND '20190202'

Pls. Help

1
BigQuery doesn't support DML over wildcard tables. - Pentium10
Is there any have to delete multiple tables in bigquery. Pls. Help - Ramakrishnan M
Only if you setup a piece of code to do it. - Pentium10
can you pls. help me on how to achieve this. thank you - Ramakrishnan M

1 Answers

0
votes

BigQuery scripting is in Beta now.

You can now simply stack multiple DELETE statements like:

delete  FROM `abc.analytics_151541058.events_20190201` WHERE event_date='20190201'
delete  FROM `abc.analytics_151541058.events_20190202` WHERE event_date='20190202'