Altering a database schema
In this recipe, you will learn how to alter a database in Hive.
Getting ready
The ALTER DATABASE
command in Hive is used to alter dbproperties
or set the dbproperties
of a database. Using the ALTER DATABASE
command, we can only alter dbproperties
and nothing else (not even the name and directory location of a database can be altered). No other metadata about the database can be changed. The general format for altering a database is as follows:
ALTER (DATABASE|SCHEMA) database_name SET DBPROPERTIES (property_name=property_value, ...);
Where:
DATABASE|SCHEMA
: These are the same thing. These words can be used interchangeably:
SET DBPROPERTIES (property_name=property_value, ...)
This clause is used to set the properties for a database. These properties are key-value pairs that can be associated with the database to attach additional information about the database.
How to do it…
Follow these steps to alter a database in Hive:
The preceding statement alters the dbproperties...