Script to delete all tables in Hive
There is no query is available for delete all the tables in hive. so we need to write a script for delete the all the tables in hive. The below script is used to delete the all the table in hive.
1.Delete all the tables in hive without database
$ vi hive-table_delete.sh
hive -e 'show tables' | xargs -I '{}' hive -e 'drop table {}'
2.Delete all the tables in hive with database
$ vi hive-table_delete.sh
hive -e 'use databasename;show tables' | xargs -I '{}' hive -e 'drop table {}'
Note:
X args command in UNIX or Linux operating system is used to pass the output of one command as an argument to another command
No comments:
Post a Comment