Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hive - how to drop external hive table along with data

I am using

drop table <table_name>

If I recreate the table with the same schema and name, I am getting the old data back. Should I remove the table directory from hdfs file system to completely get rid of the data?

like image 226
amrk7 Avatar asked Nov 24 '12 13:11

amrk7


1 Answers

You have to change the external to internal table before drop it:

example

beeline> ALTER TABLE $tablename SET TBLPROPERTIES('EXTERNAL'='False'); // make the table as internal

and then:

beeline> drop table $tablename; //if you drop the table data will be dropped as well.
like image 189
HISI Avatar answered Oct 12 '22 00:10

HISI