文档

BatchCreatePartitions - 批量新增元数据表的分区

更新时间:

为数据湖的元数据表,批量新增多个分区。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。
  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。
  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:
    • 对于必选的资源类型,用背景高亮的方式表示。
    • 对于不支持资源级授权的操作,用全部资源表示。
  • 条件关键字:是指云产品自身定义的条件关键字。
  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。
操作访问级别资源类型条件关键字关联操作
dlf:BatchCreatePartitions
  • 全部资源
    *

请求语法

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

请求参数

名称类型必填描述示例值
Bodyobject

HTTP 请求体(HTTP BODY)内容,均采用 JSON 格式

CatalogIdstring

数据库分类命名空间,默认填写主账号 Uid

1344371
DatabaseNamestring

元数据库名称

database_test
IfNotExistsboolean

如果相同名字的分区已经存在,是否忽略异常

true
NeedResultboolean

是否需要返回分区信息,为 true 时结果会返回 Partitions

true
PartitionInputsarray

分区输入信息列表

PartitionInput

分区输入信息

TableNamestring

元数据表名称

test_table_20201223

返回参数

名称类型描述示例值
object

返回结果

Codestring

状态码描述

OK
Messagestring

提示相关错误信息

.
PartitionErrorsarray

错误信息

PartitionError

错误信息

Partitionsarray

分区结果,NeedResult=true 时返回

Partition

分区结果

RequestIdstring

请求 ID

B7F4B621-E41E-4C84-B97F-42B5380A32BB
Successboolean

是否成功

true

Code 错误码说明
InvalidObject:找不到对应的 Table 或 Database
AlreadyExists:对应的分区已经存在
InternalError:其他类型错误,请参考 Message 提示

示例

正常返回示例

JSON格式

{
  "Code": "OK",
  "Message": ".",
  "PartitionErrors": [
    {
      "ErrorDetail": {
        "Code": "401",
        "Message": "auth failed"
      },
      "PartitionValues": [
        "2010"
      ]
    }
  ],
  "Partitions": [
    {
      "CreateTime": 1608730999,
      "DatabaseName": "database_test",
      "LastAccessTime": 1608730999,
      "LastAnalyzedTime": 1608730999,
      "Parameters": {
        "key": "key"
      },
      "Privileges": {
        "GroupPrivileges": {
          "key": [
            {
              "CreateTime": 1606226844,
              "GrantOption": true,
              "Grantor": "Grantor",
              "GrantorType": "GrantorType",
              "Privilege": "Privilege"
            }
          ]
        },
        "RolePrivileges": {
          "key": [
            {
              "CreateTime": 1606226844,
              "GrantOption": true,
              "Grantor": "Grantor",
              "GrantorType": "GrantorType",
              "Privilege": "Privilege"
            }
          ]
        },
        "UserPrivileges": {
          "key": [
            {
              "CreateTime": 1606226844,
              "GrantOption": true,
              "Grantor": "Grantor",
              "GrantorType": "GrantorType",
              "Privilege": "Privilege"
            }
          ]
        }
      },
      "Sd": {
        "BucketCols": [
          "2010"
        ],
        "Cols": [
          {
            "Comment": "comment_day",
            "Name": "day",
            "Parameters": {
              "key": "key"
            },
            "Type": "int"
          }
        ],
        "Compressed": false,
        "InputFormat": "org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat",
        "Location": "file:///tmp/table",
        "NumBuckets": 10,
        "OutputFormat": "org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat",
        "Parameters": {
          "key": "key"
        },
        "SerDeInfo": {
          "Name": "name",
          "Parameters": {
            "key": "key"
          },
          "SerializationLib": "org.apache.hadoop.hive.serde2.OpenCSVSerde"
        },
        "SkewedInfo": {
          "SkewedColNames": [
            "col1"
          ],
          "SkewedColValueLocationMaps": {
            "key": "{“col1”:\"val1\"}"
          },
          "SkewedColValues": [
            [
              "\"123\""
            ]
          ]
        },
        "SortCols": [
          {
            "Col": "col1",
            "Order": 1
          }
        ],
        "StoredAsSubDirectories": false
      },
      "TableName": "test_table_20201223",
      "Values": [
        "part1"
      ]
    }
  ],
  "RequestId": "B7F4B621-E41E-4C84-B97F-42B5380A32BB",
  "Success": true
}

JSON格式

{
  "Code": "OK",
  "Message": ".",
  "PartitionErrors": [
    {
      "ErrorDetail": {
        "Code": "401",
        "Message": "auth failed"
      },
      "PartitionValues": [
        "2010"
      ]
    }
  ],
  "Partitions": [
    {
      "CreateTime": 1608730999,
      "DatabaseName": "database_test",
      "LastAccessTime": 1608730999,
      "LastAnalyzedTime": 1608730999,
      "Parameters": {
        "key": "key"
      },
      "Privileges": {
        "GroupPrivileges": {
          "key": [
            {
              "CreateTime": 1606226844,
              "GrantOption": true,
              "Grantor": "Grantor",
              "GrantorType": "GrantorType",
              "Privilege": "Privilege"
            }
          ]
        },
        "RolePrivileges": {
          "key": [
            {
              "CreateTime": 1606226844,
              "GrantOption": true,
              "Grantor": "Grantor",
              "GrantorType": "GrantorType",
              "Privilege": "Privilege"
            }
          ]
        },
        "UserPrivileges": {
          "key": [
            {
              "CreateTime": 1606226844,
              "GrantOption": true,
              "Grantor": "Grantor",
              "GrantorType": "GrantorType",
              "Privilege": "Privilege"
            }
          ]
        }
      },
      "Sd": {
        "BucketCols": [
          "2010"
        ],
        "Cols": [
          {
            "Comment": "comment_day",
            "Name": "day",
            "Parameters": {
              "key": "key"
            },
            "Type": "int"
          }
        ],
        "Compressed": false,
        "InputFormat": "org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat",
        "Location": "file:///tmp/table",
        "NumBuckets": 10,
        "OutputFormat": "org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat",
        "Parameters": {
          "key": "key"
        },
        "SerDeInfo": {
          "Name": "name",
          "Parameters": {
            "key": "key"
          },
          "SerializationLib": "org.apache.hadoop.hive.serde2.OpenCSVSerde"
        },
        "SkewedInfo": {
          "SkewedColNames": [
            "col1"
          ],
          "SkewedColValueLocationMaps": {
            "key": "{“col1”:\"val1\"}"
          },
          "SkewedColValues": [
            [
              "\"123\""
            ]
          ]
        },
        "SortCols": [
          {
            "Col": "col1",
            "Order": 1
          }
        ],
        "StoredAsSubDirectories": false
      },
      "TableName": "test_table_20201223",
      "Values": [
        "part1"
      ]
    }
  ],
  "RequestId": "B7F4B621-E41E-4C84-B97F-42B5380A32BB",
  "Success": true
}

错误码

访问错误中心查看更多错误码。

  • 本页导读 (0)