码迷,mamicode.com
首页 > 其他好文 > 详细

Hive drop table batched

时间:2015-03-18 15:25:01      阅读:131      评论:0      收藏:0      [点我收藏+]

标签:

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.

Hive drop table batched

标签:

原文地址:http://www.cnblogs.com/huaxiaoyao/p/4346965.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!