Mickaël
Mickaël

Reputation: 23

Hive - query table comments

I have tables with a comment. I added the comment using:

ALTER TABLE table1 SET TBLPROPERTIES ('comment' = 'Hello World!');

ALTER TABLE table2 SET TBLPROPERTIES ('comment' = 'Hello World!');

...

Now my question is, is there a table storing the table properties ? I want to write a query returning the following data :

+------------+--------------+ | Table | Comment | +------------+--------------+ | table1 | Hello World! | | table2 | Hello World! | +------------+--------------+

Thanks !

Upvotes: 2

Views: 5155

Answers (3)

anubhavxkumar
anubhavxkumar

Reputation: 41

DESCRIBE FORMATTED tablename; This command can help you get the comments along with many more information.

Upvotes: 0

pedram bashiri
pedram bashiri

Reputation: 1376

Unfortunately, I couldn't find any easier way for a query to return comments than what @Rijul suggested. But if you're on Cloudera and you just wanna be able to see the comments, this could help: On Hue query editor, right click on the table (or view) name and choose "show details". Under the tab details, you can see the comment for that table.

Upvotes: 1

Rijul
Rijul

Reputation: 1445

Yes their is a embedded data base which stores all the metadata of hive tables schema and other properties.

by default when you setup your hadoop cluster and hive , apache Derby is used for storing hive metadata. although you can change your meta database to postgres or mysql etc while creating your cluster.

so answer to your question is you have to manually install apache derby drivers and through commandline you can query apache derby data base for your desired output, assuming your cluster is using derby. either way you have to find out what is used in your case.

more information on hive metastore: http://www.cloudera.com/documentation/enterprise/latest/topics/cdh_ig_hive_metastore_configure.html

information about derby: https://cwiki.apache.org/confluence/display/Hive/AdminManual+MetastoreAdmin#AdminManualMetastoreAdmin-Local/EmbeddedMetastoreDatabase(Derby)

Upvotes: 0

Related Questions