Help Center> Data Lake Insight> SQL Syntax Reference> SQL Syntax of Batch Jobs> Syntax for Partitioning a Table> Updating Partitioned Table Data (Only OBS Tables Supported)

Updating Partitioned Table Data (Only OBS Tables Supported)

Function

This statement is used to update the partition information about a table in the Metastore.

Syntax

1
2
MSCK REPAIR TABLE table_name;
ALTER TABLE table_name RECOVER PARTITIONS;

Keyword

None

Precautions

  • This statement is applied only to partitioned tables. After you manually add partition directories to OBS, run this statement to update the newly added partition information in the metastore. The SHOW PARTITIONS table_name statement can be used to query the newly-added partitions.
  • The partition directory name must be in the specified format, that is, tablepath/partition_column_name=partition_column_value.

Example

Run the following statements to update the partition information about table ptable in the Metastore:

1
2
MSCK REPAIR TABLE ptable;
ALTER TABLE ptable RECOVER PARTITIONS;