Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How to get all the External Hive table details from the HDFS paths?

Highlighted

How to get all the External Hive table details from the HDFS paths?

New Contributor

How to get the details of the Hive table from the HDFS path? I dont want to use "show create table", cuz I need to get the info from the HDFS path to the table and not from the table to the path

4 REPLIES 4

Re: How to get all the External Hive table details from the HDFS paths?

Super Collaborator

You will need to query the Hive metastore to

1. Filter on External tables

2. JOIN all tables (TBLS table) with all databases (DBS table)

3. Select the path

See here, for example - https://stackoverflow.com/questions/44151670/search-a-table-in-all-databases-in-hive

Or if you cannot connect to the metastore, you will need to scan over Hive tables - https://stackoverflow.com/questions/35004455/how-to-get-all-table-definitions-in-a-database-in-hive

Re: How to get all the External Hive table details from the HDFS paths?

New Contributor

@Jordan Moore Thanks it worked

Re: How to get all the External Hive table details from the HDFS paths?

New Contributor

Hello @JordanMoore @shashankvc @sihi_yassine ,

 

As per your requirement you want list of all external hive tables along with HDFS path location.

Database name,Table name,Table Type(External) and HDFS Location of hive External tables.

First login to Hive metastore and use the database which is storing all hive metadata 

Use 3 tables TBLS,DBS and SDS tables , on top of this 3 tables we can apply joins on DB_ID and SD_ID

For more information and query output please check below link .

 

https://askdoubts.com/question/how-to-find-out-list-of-all-hive-external-tables-and-hdfs-paths-from-...

 

Thanks,

Mahesh

Re: How to get all the External Hive table details from the HDFS paths?

Expert Contributor

@Shashank V C

Why don't you use "beeline"!!

cuz I don't think hdfs can know notice the difference between external table and no external table!

Don't have an account?
Coming from Hortonworks? Activate your account here