1
我在找Hive中的所有表定义。我知道,对于单表的定义我可以使用类似 -如何获取Hive数据库中的所有表定义?
describe <<table_name>>
describe extended <<table_name>>
但是,我无法找到一个办法让所有的表定义。在megastore中是否有类似于MySQL中的Information_Schema的表或者是否有命令来获取所有表定义?
我在找Hive中的所有表定义。我知道,对于单表的定义我可以使用类似 -如何获取Hive数据库中的所有表定义?
describe <<table_name>>
describe extended <<table_name>>
但是,我无法找到一个办法让所有的表定义。在megastore中是否有类似于MySQL中的Information_Schema的表或者是否有命令来获取所有表定义?
你可以通过编写一个简单的bash脚本和一些bash命令来做到这一点。
首先,写在一个数据库中的所有表名用一个文本文件:此列表中
$hive -e 'show tables in <dbname>' | tee tables.txt
然后创建一个bash脚本(describe_tables.sh)遍历每个表:
while read line
do
echo "$line"
eval "hive -e 'describe <dbname>.$line'"
done
然后执行该脚本:
$chmod +x describe_tables.sh
$./describe_tables.sh <tables.txt> definitions.txt
的definitions.txt文件将包含所有的表defini蒸发散。
另一个可疑类似于http://stackoverflow.com/questions/35005191/query-hive-meta-store/35012810的问题 –