Script to delete all tables in Hive

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

Tags:

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 {}’

    /rob

  2. cse Says:

    Thanks, exactly what I was looking for.

    Christophe

Leave a Reply