我在Hive中有几个表具有相同的前缀,如下所示...
temp_table_name
temp_table_add
temp_table_area
我在我的数据库中有几百个这样的表,还有许多其他表。 我想删除以"temp_table"开头的表。 你们中有谁知道可以在Hive中完成这项工作的查询吗?
SELECT CONCAT('DROP TABLE ', table_name, ';') FROM information_schema.tables WHERE table_name LIKE 'temp_table%';
hive -e "show tables 'temp_*'" | xargs -I '{}' hive -e 'drop table {}'
- Alex Raj Kaliamoorthybeeline --showHeader=false --outputformat=csv2 -e"use <db>; show tables 'temp_*'" | xargs -I '{}' beeline -e'use<db>; drop table {}'
- habarnam