Td-Vc
Td-Vc

Reputation: 11

Hive -where are tables information stored

I am creating and insert tables in HIVE,and the files are created on HDFS and some on external storage S3

Assuming if I created a 10 tables,is there any system table in Hive where I can find the table info created by the user??? (for example like in Teradata we have DBC.tablesv which hold information of all the user defined tables)

Upvotes: 1

Views: 1334

Answers (3)

Andrea
Andrea

Reputation: 4473

I'm not sure I understood 100% your question, if you mean the informations about the creation of the table, like the query itself, with the location on HDFS, table properties, etc, you can try with:

SHOW CREATE TABLE <table>;

If you need to retrieve a list of the columns names and datatypes try with:

DESCRIBE <table>;

Upvotes: 0

belostoky
belostoky

Reputation: 974

You can find where you metastore is configured to be in the hive-site.xml file.
Its usual location is under /etc/hive/{$hadoop_version}/ or /etc/hive/conf/.
grep for "hive.metastore.uris" or "javax.jdo.option.ConnectionURL" to see which db you are using for the metastore. The credentials should also be there.
If, for example, your metastore is on a MySQL server, you can run queries like
SELECT * FROM TBLS;
SELECT * FROM PARTITIONS;
etc

Upvotes: 1

David דודו Markovitz
David דודו Markovitz

Reputation: 44911

You can't query (as in SELECT ... FROM...) the metadata from within Hive.
You do however have comnands that display that information, e.g. show databases, show tables, desc MyTable etc.

Upvotes: 0

Related Questions