sqlgoogle-bigquerygoogle-cloud-platform

How to drop multiple tables in Big query using Wildcards TABLE_DATE_RANGE()?


I was looking at the documentation but I haven't found the way to Drop multiple tables using wild cards.

I was trying to do something like this but it doesn't work:

DROP TABLE
 TABLE_DATE_RANGE([clients.sessions_], 
                  TIMESTAMP('2017-01-01'), 
                  TIMESTAMP('2017-05-31'))

Solution

  • I just used python to loop this and solve it using Graham example:

     from subprocess import call
    
    
       return_code = call('bq  rm -f -t dataset.' + table_name +'_'+  period + '', shell=True)