There will be certain database objects introduced during deployments and hotfixes. Comments are frequently used to indicate which item is introduced in which deployment. However, this is true for OLTP.
Comments are also necessary to understand why the object was formed and what information it would store. This is applicable to both OLTP and OLAP.
While creating the database, table, and table columns, Apache Hive allows you to add comments. These comments can be left blank if you don’t want to. In this post, we’ll look at how to add table comments.
Here is the syntax to add comments while creating the table.
CREATE [EXTERNAL] TABLE [IF NOT EXISTS] [db_name.]table_name
(col_name data_type [COMMENT ‘col_comment’],, …)
[ROW FORMAT row_format]
[FIELDS TERMINATED BY char]
[STORED AS file_format];
CREATE TABLE TestTable
( TestID INT,
[COMMENT ‘This table will have test analysis data’]
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ‘\t’
STORED AS TEXTFILE;
In order to view the comments of the table, use DESC FORMATTED <tableName> command.
Hope you find this article helpful.
Please subscribe for more interesting updates.