- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Count all db, tables and partitions in hive
- Labels:
-
Apache Hive
-
Apache Impala
Created on
‎04-13-2021
08:43 AM
- last edited on
‎04-13-2021
01:24 PM
by
ask_bill_brooks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I need to know how many bases, tables and partitions we have in hive. Taking into account that the cluster has more than 10,000 bases, it is ruled out to do it manually.
Please could you tell me if it can be done by querry and how to do it?
Thank you!
Greetings.
Hernan.
Created on ‎04-13-2021 06:39 PM - edited ‎04-13-2021 06:41 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
You have the following commands from hive
show databases
show tables
show partitions <dbName>.<tableName>;
You can write your script to count, one example, count number of tables
hive -e "show databases" >db3.out;cat db3.out | while read line; do hive -e "use $line;show tables" >> tables3.out;done; cat tables3.out | wc -l
PS: there maybe some unwanted characters, you may want to do some cleaning up before final count
