Creates multiple partitions in a metadata table in Data Lake Formation (DLF) at a time.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request headers

This operation uses only common request headers. For more information, see Common request parameters.

Request syntax

POST /api/metastore/catalogs/databases/tables/partitions/batchcreate 

Request parameters

Parameter Type Position Required Example Description
Object Body No

The HTTP request body, in the JSON format.

CatalogId String Body No 1344371

The catalog ID of the metadatabase. Default value: the user ID of your Alibaba Cloud account.

DatabaseName String Body No database_test

The name of the metadatabase.

IfNotExists Boolean Body No true

Specifies whether to ignore errors if the partition name already exists.

NeedResult Boolean Body No true

Specifies whether to return partition information. A value of true indicates that the partition information will be returned.

PartitionInputs Array of Common data structures Body No

The information about partitions.

TableName String Body No test_table_20201223

The name of the metadata table.

RegionId String Host No cn-hangzhou

The ID of the region where DLF is activated.

Response parameters

Parameter Type Example Description
Code String OK

The description of the status code.

Message String .

The error message that is returned.

PartitionErrors Array of Common data structures

The partition errors that are returned.

Partitions Array of Common data structures

The partition information, which is returned if the NeedResult parameter is set to true.

RequestId String B7F4B621-E41E-4C84-B97F-42B5380A32BB

The ID of the request.

Success Boolean true

Indicates whether the call was successful.

Error codes

InvalidObject: The specified table or database does not exist.

AlreadyExists: The specified partition already exists.

InternalError: An internal error has occurred. Troubleshoot the error based on the error message that is returned.

Examples

Sample requests

POST /api/metastore/catalogs/databases/tables/partitions/batchcreate HTTP/1.1 
{
  "CatalogId": "1344371",
  "DatabaseName": "database_test",
  "TableName": "test_table_20201223",
  "IfNotExists": true,
  "NeedResult": false,
  "PartitionInputs": [{
    "Values": [
      "20201124"
    ],
    "LastAccessTime": 0,
    "LastAnalyzedTime": 0,
    "Sd": {
      "Cols": [
        {
          "Comment": "user_name",
          "Name": "name",
          "Type": "string",
          "Parameters": {}
        } 
      ],
      "Compressed": false,
      "InputFormat": "input",
      "Location": "",
      "NumBuckets": 5,
      "OutputFormat": "output",
      "Parameters": {},
      "SerDeInfo": {
        "Name": "",
        "SerializationLib": "",
        "Parameters": {}
      },
      "SkewedInfo": {
        "SkewedColNames": [],
        "SkewedColValues": [],
        "SkewedColValueLocationMaps": {}
      },
      "StoredAsSubDirectories": false
    },
    "Parameters": {},
    "Privileges": {}
  }]
}

Sample success responses

JSON format

{
  "Code": "OK",
  "HttpStatusCode": 200,
  "Message": "",
  "RequestId": "BBAB13C6-BC97-4E8D-BB02-F0F2FD77B1B2",
  "Success": true
}

Error codes

For a list of error codes, visit the API Error Center.