Hive drop table batched

if the hive version not support drop table tablename purge.

your drop table command will move data to .Trash in hdfs.

dfs .Trash;

drop table tablename;

dfs .Trash/Current;

 

#batch drop tables you want in hive.

hive --database databaseName -e "show tables '*_evan'" >>tables.txt;

---read line from txt files

while read line

do

#echo "drop table $line;"

hive --database databasename -e "drop table if exists $line;";

done < tables.txt

#output the drop table tableName to a hql file, then execute the file.

posted on 2015-03-18 13:39  tneduts  阅读(1012)  评论(0编辑  收藏  举报

导航