查看hive表的所有建表语句并保存

3个文件:

tablesDDL.sh
tablesName.txt
tablesName.txt
dim_pub_bigarea_df
dim_pub_bigarea_df_temp
dim_pub_bus_pline_df
dim_pub_business_industry_groups_classification_df
dim_pub_business_industry_groups_classification_df_temp
tablesDDL.sh
#!/bin/bash
cat /root/hivedata/tablesName.txt | while read tableName
do
hive -e "use ddi; show create table $tableName" >> /root/hivedata/tablesDDL.sql
done

然后,   

chmod  777  tablesDDL.txt
bash  tablesDDL.txt

生成整库ddi的建表语句文档

tablesDDL.sql

 

posted @ 2022-06-16 16:31  一只艾米果  阅读(467)  评论(0编辑  收藏  举报