<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: How to query table/column comments in HIVE Metastore? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-to-query-table-column-comments-in-HIVE-Metastore/m-p/205082#M167068</link>
    <description>&lt;P&gt;Hi Michael,&lt;/P&gt;&lt;P&gt;As mentioned in that stackoverflow question, we will need to query the underlying RDBMS that Hive Metastore sits on.  For instance, in my demo environment, I use MySQL as the back Hive Metastore storage.  I will need to connect to that MySql host and query the Hive metadata.  &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="83425-metastorerdmbshost.png" style="width: 1073px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17135i378BEF7A81EF5A8E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="83425-metastorerdmbshost.png" alt="83425-metastorerdmbshost.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;For demonstration purpose, let's add some comments at both table and column level, table name 'airline_tweets' for instance.&lt;/P&gt;&lt;P&gt;Add a comment at the table level:&lt;/P&gt;&lt;PRE&gt;ALTER TABLE airline_tweets SET TBLPROPERTIES ('comment' = 'Airline Tweets');&lt;/PRE&gt;&lt;P&gt;Add a comment to column 'tweet_id'&lt;/P&gt;&lt;PRE&gt;ALTER TABLE airline_tweets CHANGE tweet_id tweet_id STRING COMMENT 'This is column tweet_id';&lt;/PRE&gt;&lt;P&gt;Now let's connect to the MySQL host as mentioned above, I'm connecting as the root user, you can also use user 'hive'.  &lt;/P&gt;&lt;PRE&gt;[root@scregionm2 ~]# mysql -u root
mysql&amp;gt; use hive;
mysql&amp;gt; show tables;
+---------------------------+
| Tables_in_hive            |
+---------------------------+
| AUX_TABLE                 |
| BUCKETING_COLS            |
| CDS                       |
| COLUMNS_V2                |
| COMPACTION_QUEUE          |
| COMPLETED_COMPACTIONS     |
| COMPLETED_TXN_COMPONENTS  |
| DATABASE_PARAMS           |
| DBS                       |
| DB_PRIVS                  |
| DELEGATION_TOKENS         |
| FUNCS                     |
| FUNC_RU                   |
| GLOBAL_PRIVS              |
| HIVE_LOCKS                |
| IDXS                      |
| INDEX_PARAMS              |
| KEY_CONSTRAINTS           |
| MASTER_KEYS               |
| NEXT_COMPACTION_QUEUE_ID  |
| NEXT_LOCK_ID              |
| NEXT_TXN_ID               |
| NOTIFICATION_LOG          |
| NOTIFICATION_SEQUENCE     |
| NUCLEUS_TABLES            |
| PARTITIONS                |
| PARTITION_EVENTS          |
| PARTITION_KEYS            |
| PARTITION_KEY_VALS        |
| PARTITION_PARAMS          |
| PART_COL_PRIVS            |
| PART_COL_STATS            |
| PART_PRIVS                |
| ROLES                     |
| ROLE_MAP                  |
| SDS                       |
| SD_PARAMS                 |
| SEQUENCE_TABLE            |
| SERDES                    |
| SERDE_PARAMS              |
| SKEWED_COL_NAMES          |
| SKEWED_COL_VALUE_LOC_MAP  |
| SKEWED_STRING_LIST        |
| SKEWED_STRING_LIST_VALUES |
| SKEWED_VALUES             |
| SORT_COLS                 |
| TABLE_PARAMS              |
| TAB_COL_STATS             |
| TBLS                      |
| TBL_COL_PRIVS             |
| TBL_PRIVS                 |
| TXNS                      |
| TXN_COMPONENTS            |
| TYPES                     |
| TYPE_FIELDS               |
| VERSION                   |
| WRITE_SET                 |
+---------------------------+
57 rows in set (0.00 sec)

&lt;/PRE&gt;&lt;P&gt;As you can see all the Hive metadata are stored in those tables.  Besides using the 'describe' command in Hive, you can also retrieve the column comments from the Hive metastore database, below is the SQL command I used to query the column comment we just added:&lt;/P&gt;&lt;PRE&gt;mysql&amp;gt; SELECT c.* FROM hive.TBLS t  JOIN hive.DBS d  ON t.DB_ID = d.DB_ID  JOIN hive.SDS s  ON t.SD_ID = s.SD_ID  JOIN hive.COLUMNS_V2 c  ON s.CD_ID = c.CD_ID  WHERE TBL_NAME = 'airline_tweets' AND d.NAME= 'default'  ORDER by INTEGER_IDX;
+-------+-------------------------+------------------------------+-----------+-------------+
| CD_ID | COMMENT                 | COLUMN_NAME                  | TYPE_NAME | INTEGER_IDX |
+-------+-------------------------+------------------------------+-----------+-------------+
|   141 | This is column tweet_id | tweet_id                     | string    |           0 |
|   141 | NULL                    | airline_sentiment            | string    |           1 |
|   141 | NULL                    | airline_sentiment_confidence | string    |           2 |
|   141 | NULL                    | negativereason               | string    |           3 |
|   141 | NULL                    | negativereason_confidence    | string    |           4 |
|   141 | NULL                    | airline                      | string    |           5 |
|   141 | NULL                    | airline_sentiment_gold       | string    |           6 |
|   141 | NULL                    | name                         | string    |           7 |
|   141 | NULL                    | negativereason_gold          | string    |           8 |
|   141 | NULL                    | retweet_count                | string    |           9 |
|   141 | NULL                    | text                         | string    |          10 |
|   141 | NULL                    | tweet_coord                  | string    |          11 |
|   141 | NULL                    | tweet_created                | string    |          12 |
|   141 | NULL                    | tweet_location               | string    |          13 |
|   141 | NULL                    | user_timezone                | string    |          14 |
+-------+-------------------------+------------------------------+-----------+-------------+
&lt;/PRE&gt;&lt;P&gt;And here is the SQL command for retrieving the table comment we just added:&lt;/P&gt;&lt;PRE&gt;mysql&amp;gt; SELECT d.* FROM hive.TBLS t  JOIN hive.TABLE_PARAMS d  ON t.TBL_ID = d.TBL_ID  WHERE TBL_NAME = 'airline_tweets';
+--------+-----------------------+----------------+
| TBL_ID | PARAM_KEY             | PARAM_VALUE    |
+--------+-----------------------+----------------+
|      1 | comment               | Airline Tweets |
|      1 | last_modified_by      | dsun           |
|      1 | last_modified_time    | 1532533100     |
|      1 | numFiles              | 0              |
|      1 | numRows               | 14872          |
|      1 | rawDataSize           | 21569185       |
|      1 | totalSize             | 0              |
|      1 | transient_lastDdlTime | 1532533100     |
+--------+-----------------------+----------------+
8 rows in set (0.00 sec)
&lt;/PRE&gt;&lt;P&gt;You can create your own SQL command if you need to retrieve commends for table &amp;amp; columns at the same time, all the tables are there.&lt;/P&gt;&lt;P&gt;Please 'Accept' the answer if you found it resolved your question.&lt;/P&gt;&lt;P&gt;Derek&lt;/P&gt;</description>
    <pubDate>Sun, 18 Aug 2019 04:54:56 GMT</pubDate>
    <dc:creator>dsun</dc:creator>
    <dc:date>2019-08-18T04:54:56Z</dc:date>
    <item>
      <title>How to query table/column comments in HIVE Metastore?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-query-table-column-comments-in-HIVE-Metastore/m-p/205079#M167065</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to figure out how to query table and column comments (descriptions) in HIVE Metastore. If there is a way to add the comments to HIVE tables/columns, shouldn't be a way to query/report on the comments from HIVE Metastore?&lt;/P&gt;&lt;P&gt;Please help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Best Regards, Michael&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 04:33:30 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-query-table-column-comments-in-HIVE-Metastore/m-p/205079#M167065</guid>
      <dc:creator>m_okulik</dc:creator>
      <dc:date>2018-07-25T04:33:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to query table/column comments in HIVE Metastore?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-query-table-column-comments-in-HIVE-Metastore/m-p/205080#M167066</link>
      <description>&lt;P&gt;Hi Michael,&lt;/P&gt;&lt;P&gt;For table comments, there is a &lt;A href="https://stackoverflow.com/questions/40615899/hive-query-table-comments" rel="nofollow noopener noreferrer" target="_blank"&gt;stackoverflow article&lt;/A&gt; around it.  For column comments, you can simply run the hive command 'DESCRIBE tablename;', and you should see a comment column in the results.  &lt;/P&gt;&lt;P&gt;The easiest way would be using Apache Atlas, if you have Atlas installed, you should be able to see all the table/column metadata, including comments in the Atlas UI.&lt;/P&gt;&lt;P&gt;For instance, I added some comments to an existing Hive table, called 'airline_tweets'&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="83408-addtablecomment.png" style="width: 941px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17136iD291543B51CB7DAC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="83408-addtablecomment.png" alt="83408-addtablecomment.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Then I am able to see the table/column comments in Atlas&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="83409-atlas1.png" style="width: 1859px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17137i207FEBA75EA46773/image-size/medium?v=v2&amp;amp;px=400" role="button" title="83409-atlas1.png" alt="83409-atlas1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Atlas is great tool to use for enterprise data governance.  Hope that helps!&lt;/P&gt;&lt;P&gt;If you found it resolved the issue, please "accept" the answer, thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 04:55:09 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-query-table-column-comments-in-HIVE-Metastore/m-p/205080#M167066</guid>
      <dc:creator>dsun</dc:creator>
      <dc:date>2019-08-18T04:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to query table/column comments in HIVE Metastore?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-query-table-column-comments-in-HIVE-Metastore/m-p/205081#M167067</link>
      <description>&lt;P&gt;@dsun thanks for the response. &lt;/P&gt;&lt;P&gt;Are the table/column comments stored somewhere in HIVE Metastore? I already know about the describe command and Atlas. I need to extract the table/column comments into a table/file, not simply view them on screen. I hope this makes sense.&lt;/P&gt;&lt;P&gt;Does anyone else know how to query table/column comments using HIVE Metastore?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 21:51:56 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-query-table-column-comments-in-HIVE-Metastore/m-p/205081#M167067</guid>
      <dc:creator>m_okulik</dc:creator>
      <dc:date>2018-07-25T21:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to query table/column comments in HIVE Metastore?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-query-table-column-comments-in-HIVE-Metastore/m-p/205082#M167068</link>
      <description>&lt;P&gt;Hi Michael,&lt;/P&gt;&lt;P&gt;As mentioned in that stackoverflow question, we will need to query the underlying RDBMS that Hive Metastore sits on.  For instance, in my demo environment, I use MySQL as the back Hive Metastore storage.  I will need to connect to that MySql host and query the Hive metadata.  &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="83425-metastorerdmbshost.png" style="width: 1073px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/17135i378BEF7A81EF5A8E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="83425-metastorerdmbshost.png" alt="83425-metastorerdmbshost.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;For demonstration purpose, let's add some comments at both table and column level, table name 'airline_tweets' for instance.&lt;/P&gt;&lt;P&gt;Add a comment at the table level:&lt;/P&gt;&lt;PRE&gt;ALTER TABLE airline_tweets SET TBLPROPERTIES ('comment' = 'Airline Tweets');&lt;/PRE&gt;&lt;P&gt;Add a comment to column 'tweet_id'&lt;/P&gt;&lt;PRE&gt;ALTER TABLE airline_tweets CHANGE tweet_id tweet_id STRING COMMENT 'This is column tweet_id';&lt;/PRE&gt;&lt;P&gt;Now let's connect to the MySQL host as mentioned above, I'm connecting as the root user, you can also use user 'hive'.  &lt;/P&gt;&lt;PRE&gt;[root@scregionm2 ~]# mysql -u root
mysql&amp;gt; use hive;
mysql&amp;gt; show tables;
+---------------------------+
| Tables_in_hive            |
+---------------------------+
| AUX_TABLE                 |
| BUCKETING_COLS            |
| CDS                       |
| COLUMNS_V2                |
| COMPACTION_QUEUE          |
| COMPLETED_COMPACTIONS     |
| COMPLETED_TXN_COMPONENTS  |
| DATABASE_PARAMS           |
| DBS                       |
| DB_PRIVS                  |
| DELEGATION_TOKENS         |
| FUNCS                     |
| FUNC_RU                   |
| GLOBAL_PRIVS              |
| HIVE_LOCKS                |
| IDXS                      |
| INDEX_PARAMS              |
| KEY_CONSTRAINTS           |
| MASTER_KEYS               |
| NEXT_COMPACTION_QUEUE_ID  |
| NEXT_LOCK_ID              |
| NEXT_TXN_ID               |
| NOTIFICATION_LOG          |
| NOTIFICATION_SEQUENCE     |
| NUCLEUS_TABLES            |
| PARTITIONS                |
| PARTITION_EVENTS          |
| PARTITION_KEYS            |
| PARTITION_KEY_VALS        |
| PARTITION_PARAMS          |
| PART_COL_PRIVS            |
| PART_COL_STATS            |
| PART_PRIVS                |
| ROLES                     |
| ROLE_MAP                  |
| SDS                       |
| SD_PARAMS                 |
| SEQUENCE_TABLE            |
| SERDES                    |
| SERDE_PARAMS              |
| SKEWED_COL_NAMES          |
| SKEWED_COL_VALUE_LOC_MAP  |
| SKEWED_STRING_LIST        |
| SKEWED_STRING_LIST_VALUES |
| SKEWED_VALUES             |
| SORT_COLS                 |
| TABLE_PARAMS              |
| TAB_COL_STATS             |
| TBLS                      |
| TBL_COL_PRIVS             |
| TBL_PRIVS                 |
| TXNS                      |
| TXN_COMPONENTS            |
| TYPES                     |
| TYPE_FIELDS               |
| VERSION                   |
| WRITE_SET                 |
+---------------------------+
57 rows in set (0.00 sec)

&lt;/PRE&gt;&lt;P&gt;As you can see all the Hive metadata are stored in those tables.  Besides using the 'describe' command in Hive, you can also retrieve the column comments from the Hive metastore database, below is the SQL command I used to query the column comment we just added:&lt;/P&gt;&lt;PRE&gt;mysql&amp;gt; SELECT c.* FROM hive.TBLS t  JOIN hive.DBS d  ON t.DB_ID = d.DB_ID  JOIN hive.SDS s  ON t.SD_ID = s.SD_ID  JOIN hive.COLUMNS_V2 c  ON s.CD_ID = c.CD_ID  WHERE TBL_NAME = 'airline_tweets' AND d.NAME= 'default'  ORDER by INTEGER_IDX;
+-------+-------------------------+------------------------------+-----------+-------------+
| CD_ID | COMMENT                 | COLUMN_NAME                  | TYPE_NAME | INTEGER_IDX |
+-------+-------------------------+------------------------------+-----------+-------------+
|   141 | This is column tweet_id | tweet_id                     | string    |           0 |
|   141 | NULL                    | airline_sentiment            | string    |           1 |
|   141 | NULL                    | airline_sentiment_confidence | string    |           2 |
|   141 | NULL                    | negativereason               | string    |           3 |
|   141 | NULL                    | negativereason_confidence    | string    |           4 |
|   141 | NULL                    | airline                      | string    |           5 |
|   141 | NULL                    | airline_sentiment_gold       | string    |           6 |
|   141 | NULL                    | name                         | string    |           7 |
|   141 | NULL                    | negativereason_gold          | string    |           8 |
|   141 | NULL                    | retweet_count                | string    |           9 |
|   141 | NULL                    | text                         | string    |          10 |
|   141 | NULL                    | tweet_coord                  | string    |          11 |
|   141 | NULL                    | tweet_created                | string    |          12 |
|   141 | NULL                    | tweet_location               | string    |          13 |
|   141 | NULL                    | user_timezone                | string    |          14 |
+-------+-------------------------+------------------------------+-----------+-------------+
&lt;/PRE&gt;&lt;P&gt;And here is the SQL command for retrieving the table comment we just added:&lt;/P&gt;&lt;PRE&gt;mysql&amp;gt; SELECT d.* FROM hive.TBLS t  JOIN hive.TABLE_PARAMS d  ON t.TBL_ID = d.TBL_ID  WHERE TBL_NAME = 'airline_tweets';
+--------+-----------------------+----------------+
| TBL_ID | PARAM_KEY             | PARAM_VALUE    |
+--------+-----------------------+----------------+
|      1 | comment               | Airline Tweets |
|      1 | last_modified_by      | dsun           |
|      1 | last_modified_time    | 1532533100     |
|      1 | numFiles              | 0              |
|      1 | numRows               | 14872          |
|      1 | rawDataSize           | 21569185       |
|      1 | totalSize             | 0              |
|      1 | transient_lastDdlTime | 1532533100     |
+--------+-----------------------+----------------+
8 rows in set (0.00 sec)
&lt;/PRE&gt;&lt;P&gt;You can create your own SQL command if you need to retrieve commends for table &amp;amp; columns at the same time, all the tables are there.&lt;/P&gt;&lt;P&gt;Please 'Accept' the answer if you found it resolved your question.&lt;/P&gt;&lt;P&gt;Derek&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 04:54:56 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-query-table-column-comments-in-HIVE-Metastore/m-p/205082#M167068</guid>
      <dc:creator>dsun</dc:creator>
      <dc:date>2019-08-18T04:54:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to query table/column comments in HIVE Metastore?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-query-table-column-comments-in-HIVE-Metastore/m-p/205083#M167069</link>
      <description>&lt;P&gt;Your response is a bit overcomplicated. I resolved my own question. Below is a type of a query from HIVE Metastore I was looking for:&lt;/P&gt;&lt;P&gt;SELECT   DBS.NAME AS OWNER,&lt;BR /&gt;  TBLS.TBL_NAME as OBJECT_NAME,&lt;BR /&gt;  TBL_COMMENTS.TBL_COMMENT as OBJECT_DESCRIPTION,&lt;BR /&gt;  TBLS.TBL_ID as OBJECT_ID,&lt;BR /&gt;  TBLS.TBL_TYPE as OBJECT_TYPE,&lt;BR /&gt;  'VALID' as OBJECT_STATUS,&lt;BR /&gt;  COLUMNS_V2.COLUMN_NAME,&lt;BR /&gt;  COLUMNS_V2.COMMENT as COLUMN_DESCRIPTION,&lt;BR /&gt;  COLUMNS_V2.TYPE_NAME AS DATA_TYPE&lt;BR /&gt;  COLUMNS_V2.*&lt;BR /&gt;FROM  DBS&lt;BR /&gt;  JOIN TBLS &lt;BR /&gt;  ON DBS.DB_ID = TBLS.DB_ID&lt;BR /&gt;  JOIN SDS &lt;BR /&gt;  ON TBLS.SD_ID = SDS.SD_ID&lt;BR /&gt;  JOIN COLUMNS_V2 &lt;BR /&gt;  ON COLUMNS_V2.CD_ID = SDS.CD_ID&lt;BR /&gt;  JOIN (SELECT  DISTINCT &lt;BR /&gt;  TBL_ID, &lt;BR /&gt;  TBL_COMMENT &lt;BR /&gt;  FROM  (SELECT  TBLS.TBL_ID TBL_ID, &lt;BR /&gt;  TABLE_PARAMS.PARAM_KEY, &lt;BR /&gt;  TABLE_PARAMS.PARAM_VALUE, &lt;BR /&gt;  CASE WHEN TABLE_PARAMS.PARAM_KEY = 'comment' &lt;BR /&gt;  THEN TABLE_PARAMS.PARAM_VALUE &lt;BR /&gt;  ELSE '' &lt;BR /&gt;  END TBL_COMMENT&lt;BR /&gt;  FROM  TBLS &lt;BR /&gt;  JOIN TABLE_PARAMS&lt;BR /&gt;  ON TBLS.TBL_ID = TABLE_PARAMS.TBL_ID) TBL_COMMENTS_INTERNAL) TBL_COMMENTS &lt;BR /&gt;  ON TBLS.TBL_ID = TBL_COMMENTS.TBL_ID;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 23:43:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-query-table-column-comments-in-HIVE-Metastore/m-p/205083#M167069</guid>
      <dc:creator>m_okulik</dc:creator>
      <dc:date>2018-07-25T23:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to query table/column comments in HIVE Metastore?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-query-table-column-comments-in-HIVE-Metastore/m-p/298765#M219356</link>
      <description>&lt;P&gt;I tried your query, but if the table has no comment, it produces a duplicate record for that table. So I modified it a bit&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;mysql -u hive -p
&amp;lt;ENTER YOUR HIVE PASSWORD&amp;gt;
use metastore;

SELECT * FROM (SELECT DBS.NAME AS OWNER, TBLS.TBL_NAME as OBJECT_NAME, TBL_COMMENTS.TBL_COMMENT as OBJECT_DESCRIPTION, TBLS.TBL_ID as OBJECT_ID, TBLS.TBL_TYPE as OBJECT_TYPE, "VALID" as OBJECT_STATUS,COLUMNS_V2.COLUMN_NAME, COLUMNS_V2.COMMENT as COLUMN_DESCRIPTION, COLUMNS_V2.TYPE_NAME AS DATA_TYPE FROM DBS JOIN TBLS ON DBS.DB_ID = TBLS.DB_ID JOIN SDS ON TBLS.SD_ID = SDS.SD_ID JOIN COLUMNS_V2 ON COLUMNS_V2.CD_ID = SDS.CD_ID JOIN ( SELECT DISTINCT TBL_ID, TBL_COMMENT FROM ( SELECT TBLS.TBL_ID TBL_ID,TABLE_PARAMS.PARAM_KEY,TABLE_PARAMS.PARAM_VALUE, TABLE_PARAMS.PARAM_VALUE as TBL_COMMENT FROM TBLS JOIN TABLE_PARAMS ON TBLS.TBL_ID = TABLE_PARAMS.TBL_ID WHERE TABLE_PARAMS.PARAM_KEY = "comment" UNION ALL SELECT TBLS.TBL_ID TBL_ID,TABLE_PARAMS.PARAM_KEY,TABLE_PARAMS.PARAM_VALUE, "" as TBL_COMMENT FROM TBLS JOIN TABLE_PARAMS ON TBLS.TBL_ID = TABLE_PARAMS.TBL_ID WHERE TABLE_PARAMS.PARAM_KEY &amp;lt;&amp;gt; "comment" AND TBLS.TBL_ID NOT IN (SELECT TBL_ID FROM TABLE_PARAMS WHERE TABLE_PARAMS.PARAM_KEY = "comment") ) TBL_COMMENTS_INTERNAL) TBL_COMMENTS ON TBLS.TBL_ID = TBL_COMMENTS.TBL_ID) as view WHERE OWNER = "database_name_goes_here" AND OBJECT_NAME = "table_name_goes_here";&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Jun 2020 14:37:48 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-query-table-column-comments-in-HIVE-Metastore/m-p/298765#M219356</guid>
      <dc:creator>Matrix</dc:creator>
      <dc:date>2020-06-28T14:37:48Z</dc:date>
    </item>
  </channel>
</rss>

