Script to delete all tables in Hive

hive -e ‘show tables’ | xargs -I ‘{}’ hive -e ‘drop table {}’


2 Responses to “Script to delete all tables in Hive”

  1. Rob Cranfill Says:

    I might suggest you specify the database being used, if needed:
    hive -e ‘use XXX;show tables’ | xargs -I ‘{}’ hive -e ‘use XXX;drop table {}’


  2. cse Says:

    Thanks, exactly what I was looking for.


Leave a Reply