Database Comments In Hive

We addressed creating a database with database comments in an earlier post, but this article will go over it in further depth to give you a better sense of how to add and change the comments.

As discussed earlier, comments are necessary to understand why the object was formed and what information it would store. This is applicable to both OLTP and OLAP databases and database objects.

Refer to the below example:
CREATE DATABASE TestDB
WITH dbProperties(‘Creator: ‘= ‘Username’, ‘Created-Date:’ = ‘01-01-2020’);

I gave the username and database creation date in the example above. Since they’re not defined parameters, you may store any data you wish. “Creator” or “owner” or “user” or “username” are all possibilities. It may also be “created-date,” “created on,” “date created,” or anything else. Since the properties cannot be changed once they have been entered, you must plan before you provide.

If properties were overlooked during database creation, they can still be added using the ALTER command, as illustrated below.

Syntax:
ALTER (DATABASE|SCHEMA) <database_name>
SET DBPROPERTIES (‘<property_name>’='<property_value>’,..);

Example:
ALTER DATABASE TestDB
SET DBPROPERTIES ( ‘dbOwner’ = ‘ SomeUser’ , ‘ DateCreated ‘ = ‘ 2020-01-01 ‘);

Hope you find this article helpful.

Please subscribe for more interesting updates.

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s