更新时间:2024-04-08 GMT+08:00
分享

列举分区信息

功能介绍

遍历指定数据表下的分区列表,对于事务表,支持基于表的特定版本遍历分区列表。 当过滤条件不为空时,优先根据过滤条件筛选过滤, 当过滤条件为空且分区值不为空时,再根据分区值筛选过滤, 当过滤条件和分区值都为空时,返回指定数据表下所有分区。

调试

您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。

URI

GET /v1/{project_id}/instances/{instance_id}/catalogs/{catalog_name}/databases/{database_name}/tables/{table_name}/partitions

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

项目编号。获取方法,请参见获取项目ID

instance_id

String

LakeFormation实例ID。创建实例时自动生成。例如:2180518f-42b8-4947-b20b-adfc53981a25。

catalog_name

String

catalog名称。只能包含字母、数字和下划线,且长度为1~256个字符。

database_name

String

数据库名称。只能包含中文、字母、数字、下划线、中划线,且长度为1~128个字符。

table_name

String

表名称。只能包含中文、字母、数字、下划线、中划线,且长度为1~256个字符。

表2 Query参数

参数

是否必选

参数类型

描述

filter

String

分区过滤条件。最小长度为0,最大长度为256。

partition_values

Array

分区的值列表。最小元素数为0,最大元素数为1000。

limit

Integer

查询返回条数。默认值为500。最小值为1,最大值为1000。

marker

String

查询的起始记录ID。最小长度为0,最大长度为256。

reverse_page

Boolean

是否查询上一页。默认为false。

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

Array of strings

租户token。

响应参数

状态码: 200

表4 响应Body参数

参数

参数类型

描述

partitions

Array of Partition objects

分区信息。

page_info

PagedInfo object

分页信息。

表5 Partition

参数

参数类型

描述

catalog_name

String

catalog名称。

catalog_id

String

catalogID。

database_name

String

数据库名称。

database_id

String

数据库ID。

table_name

String

表名称。

table_id

String

表ID。

partition_id

String

分区ID。

partition_values

Array of strings

分区值的列表。

create_time

String

创建时间。

last_access_time

String

最后访问时间。

parameters

Map<String,String>

参数表。

storage_descriptor

StorageDescriptor object

数据存储。

表6 StorageDescriptor

参数

参数类型

描述

columns

Array of Column objects

分区列以外的所有字段。

location

String

路径地址。例如obs://location/uri/。

compressed

Boolean

是否启用数据压缩。默认为false。

input_format

String

输入格式。

output_format

String

输出格式。

number_of_buckets

Integer

分桶的桶数量。默认值为0。

bucket_columns

Array of strings

分桶字段。

sort_columns

Array of Order objects

指定表中的每个存储桶的排序顺序的列表。

serde_info

SerDeInfo object

序列化/反序列化信息。

parameters

Map<String,String>

存储描述符的参数。 key最小长度为1,最大长度为255。 value最大长度为4000

skewed_info

SkewedInfo object

有关在列中经常出现的值(偏斜值)的信息。

stored_as_sub_directories

Boolean

数据是否会存放在子目录中。

表7 Column

参数

参数类型

描述

column_type

String

列类型,包括array bigint binary boolean char date decimal double float int interval map set smallint string struct timestamp tinyint union varchar

column_name

String

列名称。只能包含中文、字母、数字和_-+*(), 特殊字符,且长度为1~767个字符。

comment

String

列描述信息。最大长度为4000个字符。

表8 Order

参数

参数类型

描述

column

String

列名称。只能包含中文、字母、数字和_-+*(), 特殊字符,且长度为1~767个字符。

sort_order

Integer

指示是按升序 (== 1) 还是降序 (==0) 对列进行排序。

表9 SerDeInfo

参数

参数类型

描述

name

String

名称信息。

serialization_library

String

实现序列化/反序列化的类。

parameters

Map<String,String>

参数数组。 key最小值1,最大值255 value最大值4000

表10 SkewedInfo

参数

参数类型

描述

skewed_column_names

Array of strings

数据偏移列的列表。

skewed_column_value_location_maps

Map<String,String>

偏斜值和地址的映射关系。

skewed_column_values

Array<Array<String>>

偏斜值的列表。

表11 PagedInfo

参数

参数类型

描述

current_count

Integer

本次返回的对象个数。最小值为0,最大值为2000。

next_marker

String

下一页查询地址。当不存在下一页,则值为null,当值为null时,响应Body无该参数。

previous_marker

String

上一页查询地址。当不存在上一页,则值为null,当值为null时,响应Body无该参数。

状态码: 400

表12 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

solution_msg

String

解决方案描述。

状态码: 404

表13 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

solution_msg

String

解决方案描述。

状态码: 500

表14 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

solution_msg

String

解决方案描述。

请求示例

GET https://{endpoint} /v1/{project_id}/instances/{instance_id}/catalogs/{catalog_name}/databases/{database_name}/tables/{table_name}/partitions

响应示例

状态码: 200

OK

{
  "partitions" : [ {
    "catalog_name" : "cat97bc31536be24f2cae8ecddf34a6d53a",
    "database_name" : "dbe062bd53192249d7a0258062ed122683",
    "table_name" : "tble25e30cecd1a4ab58ab3eba7c70b7dc2",
    "partition_values" : [ "0e3af7a7552d4aa7b75f271505495590", "936b465a11b64e28aa2d047e92908707" ],
    "create_time" : "2023-05-30T12:24:30.401+00:00",
    "last_access_time" : "2023-05-30T12:24:30.000+00:00",
    "parameters" : {
      "key1" : "value1",
      "transient_lastDdlTime" : "120",
      "classification" : "other"
    },
    "storage_descriptor" : {
      "columns" : [ {
        "column_type" : "string",
        "column_name" : "column_prefix0",
        "comment" : "b2489a84845b436d8557b2a7ae44082b"
      }, {
        "column_type" : "string",
        "column_name" : "column_prefix1",
        "comment" : "f6b3ce66332e475f99aaba1c5ba8a080"
      }, {
        "column_type" : "string",
        "column_name" : "column_prefix2",
        "comment" : "9cd48faa87e04cf0b64416d9491a0131"
      }, {
        "column_type" : "string",
        "column_name" : "column_prefix3",
        "comment" : "73b0ebce76fe4b5fa97ba29e93f69093"
      }, {
        "column_type" : "string",
        "column_name" : "column_prefix4",
        "comment" : "9339b5d828314da09900d647a4dcafe2"
      }, {
        "column_type" : "string",
        "column_name" : "column_prefix5",
        "comment" : "006d9b8151ca4816bc47ba3e53428b7b"
      }, {
        "column_type" : "string",
        "column_name" : "column_prefix6",
        "comment" : "116e112b2e8c447e942ec14995bcf659"
      }, {
        "column_type" : "string",
        "column_name" : "column_prefix7",
        "comment" : "d388b4d142834eaab7e55137f4b8089d"
      }, {
        "column_type" : "string",
        "column_name" : "column_prefix8",
        "comment" : "216f8d15eb044463b2e22a31f3bd40e9"
      }, {
        "column_type" : "string",
        "column_name" : "column_prefix9",
        "comment" : "7f8565e9381e4070b3faab51badfa035"
      } ],
      "location" : "obs://location/test/database/de0eef7ef86a4940a266c03bc7c5a548",
      "compressed" : false,
      "input_format" : "0a376351bf9c4966b9258301ba0473f7",
      "output_format" : "1297b151c9544f368f7c9a1708deb067",
      "number_of_buckets" : 0,
      "bucket_columns" : [ ],
      "sort_columns" : [ ],
      "serde_info" : {
        "name" : "b277e0cefeaf4f78aacffbe6bd714ca4",
        "serialization_library" : "8c348e0841524ce9ba0ab29cf30483cb",
        "parameters" : {
          "0804f29205a546efabd6c6934badfa81" : "4e4d5a8d807e4150af0df5cb967810dd"
        }
      },
      "parameters" : {
        "27976ea945ed4486a938e6336e7b4923" : "679081deb759451cbc3ccacdcd4e4940",
        "08f5c45c202b4572b1b3c2255205a2a6" : "7cd4dab5553f4c20b3d08d2a59b8eeca"
      },
      "skewed_info" : {
        "skewed_column_names" : [ ],
        "skewed_column_value_location_maps" : { },
        "skewed_column_values" : [ ]
      },
      "stored_as_sub_directories" : false
    }
  } ],
  "page_info" : {
    "current_count" : 1
  }
}

状态码: 400

Bad Request

{
  "error_code" : "common.01000001",
  "error_msg" : "failed to read http request, please check your input, code: 400, reason: Type mismatch., cause: TypeMismatchException"
}

状态码: 401

Unauthorized

{
  "error_code": 'APIG.1002',
  "error_msg": 'Incorrect token or token resolution failed'
}

状态码: 403

Forbidden

{
  "error" : {
    "code" : "403",
    "message" : "X-Auth-Token is invalid in the request",
    "error_code" : null,
    "error_msg" : null,
    "title" : "Forbidden"
  },
  "error_code" : "403",
  "error_msg" : "X-Auth-Token is invalid in the request",
  "title" : "Forbidden"
}

状态码: 404

Not Found

{
  "error_code" : "common.01000001",
  "error_msg" : "response status exception, code: 404"
}

状态码: 408

Request Timeout

{
  "error_code" : "common.00000408",
  "error_msg" : "timeout exception occurred"
}

状态码: 500

Internal Server Error

{
  "error_code" : "common.00000500",
  "error_msg" : "internal error"
}

状态码

状态码

描述

200

OK

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

408

Request Timeout

500

Internal Server Error

错误码

请参见错误码

分享:

    相关文档

    相关产品