This topic describes basic operations on Hive metadata, such as creating a database, deleting a database, creating a table, and deleting a table.

Prerequisites

An E-MapReduce (EMR) cluster is created. For more information, see Create a cluster.

Create a database

  1. Go to the metadata management page.
    1. Log on to the Alibaba Cloud EMR console.
    2. In the top navigation bar, select the region where your cluster resides and select a resource group based on your business requirements.
    3. Click the Metadata tab.
  2. On the Tables page, click Create Database in the upper-right corner.
  3. In the Create Database dialog box, configure parameters.
    The EMR table management feature can be used only to create databases and tables based on Object Storage Service (OSS). Set Data Source to OSS. Database and table file locations must be in a directory under an OSS bucket. Set the location to a specific directory, instead of an OSS bucket.
  4. Click OK.
    You can click Tasks to view the results.
    • If Status is Successful, the topic is added.
    • If Status is Failed, you can click View Details in the Action column to identify the cause.

Create a table

Notice You can create an external table or a partitioned table.
  1. Go to the metadata management page.
    1. Log on to the Alibaba Cloud EMR console.
    2. In the top navigation bar, select the region where your cluster resides and select a resource group based on your business requirements.
    3. Click the Metadata tab.
  2. On the Tables page, click a created metadatabase.
  3. Click Create Table in the upper-right corner.
  4. In the Create Table dialog box, configure parameters.
    Parameter Description
    Table Name The name of the table.
    Delimiter Select a delimiter or Custom from the Delimiter drop-down list.
    External Table This parameter is not selected by default.
    To create an external table, perform the following steps:
    1. Select the External Table check box. Then, click File path to specify a file path.
    2. Click Add Column and configure relevant parameters.
    Enable Partition Mode Default value: No.
    To create a partitioned table, perform the following steps:
    1. Set Enable Partition Mode to Yes.
    2. Click Add Partition Column and configure relevant parameters.
  5. Click OK.
    You can click Tasks to view the results.
    • If Status is Successful, the topic is added.
    • If Status is Failed, you can click View Details in the Action column to identify the cause.

Delete a table

  1. Go to the metadata management page.
    1. Log on to the Alibaba Cloud EMR console.
    2. In the top navigation bar, select the region where your cluster resides and select a resource group based on your business requirements.
    3. Click the Metadata tab.
  2. On the Tables page, click a created metadatabase.
  3. Find the table you want to delete and click Delete in the Actions column.
  4. In the Delete Table message, click OK.
    You can click Tasks to view the results.
    • If Status is Successful, the topic is added.
    • If Status is Failed, you can click View Details in the Action column to identify the cause.

Delete a database

Notice Before you delete a database, you must delete all tables stored in the database.
  1. Go to the metadata management page.
    1. Log on to the Alibaba Cloud EMR console.
    2. In the top navigation bar, select the region where your cluster resides and select a resource group based on your business requirements.
    3. Click the Metadata tab.
  2. On the Tables page, click a created metadatabase.
  3. Find the database you want to delete and click Delete in the Actions column.
  4. In the Delete Database message, click OK.
    You can click Tasks to view the results.
    • If Status is Successful, the topic is added.
    • If Status is Failed, you can click View Details in the Action column to identify the cause.