In previous postings, I demonstrated how to retrieve metadata from the INFORMATION SCHEMA table in MySQL. It’s now time to check Apache Hive for the same. The metadata information from the Hive warehouse will be stored in MySQL, but it will not be reflected in the information schema. The DBS database has such information.
We’ll look at how to get the number of tables in the hive database in this article.
Either you can get the information by logging into the MySQL console as shown below
use hive;
SELECT NAME, TBL_NAME FROM DBS as a, TBLS as b where a.DB_ID=b.DB_ID;
or you can get it from the terminal as shown below.
mysql -u root -e “use hive;SELECT NAME, TBL_NAME FROM DBS as a, TBLS as b where a.DB_ID=b.DB_ID;”> tables.txt
Happy learning!!