Updated on 2024-02-21 GMT+08:00

Listing Partitions

Function

Traverse the partition list in a specified data table. For a transaction table, the partition list can be traversed based on a specific version of the table. Filtering by the criteria is the system's first priority. If no criteria are given, the system filters by the partition values instead. If neither are specified, the system returns all the partitions in the data table.

URI

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

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For how to obtain the project ID, see Obtaining a Project ID (lakeformation_04_0026.xml).

instance_id

Yes

String

LakeFormation instance ID. The value is automatically generated when the instance is created, for example, 2180518f-42b8-4947-b20b-adfc53981a25.

catalog_name

Yes

String

Catalog name. The value should contain 1 to 256 characters. Only letters, numbers, and underscores (_) are allowed.

database_name

Yes

String

Database name. The value should contain 1 to 128 characters. Only letters, numbers, hyphens (-), and underscores (_) are allowed.

table_name

Yes

String

Table name. The value should contain 1 to 256 characters. Only letters, numbers, hyphens (-), and underscores (_) are allowed.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

filter

No

String

Partition filter criteria. The value consists of 0 to 256 characters.

partition_values

No

Array

Partition values. A maximum of 1,000 table names can be displayed on the page.

limit

No

Integer

Number of returned records. The default value is 500. The value ranges from 1 to 1000.

marker

No

String

ID of the record where the query starts. The value consists of 0 to 256 characters.

reverse_page

No

Boolean

Whether to query the previous page. The default value is false.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

Array of strings

Tenant token.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

partitions

Array of Partition objects

Partition information.

page_info

PagedInfo object

Pagination information.

Table 5 Partition

Parameter

Type

Description

catalog_name

String

Catalog name.

catalog_id

String

catalogID.

database_name

String

Database name.

database_id

String

Database ID.

table_name

String

Table name.

table_id

String

Table ID.

partition_id

String

Partition ID.

partition_values

Array of strings

Partition values.

create_time

String

Creation time.

last_access_time

String

Last access time.

parameters

Map<String,String>

Parameter table.

storage_descriptor

StorageDescriptor object

Data storage.

Table 6 StorageDescriptor

Parameter

Type

Description

columns

Array of Column objects

All fields except partition columns.

location

String

Path, for example, obs://location/uri/.

compressed

Boolean

Whether to enable data compression. The default value is false.

input_format

String

Input format.

output_format

String

Output format.

number_of_buckets

Integer

Number of buckets. The default value is 0.

bucket_columns

Array of strings

Bucket field.

sort_columns

Array of Order objects

A list that specifies the bucket sorting method.

serde_info

SerDeInfo object

Serialization/Deserialization information.

parameters

Map<String,String>

Descriptor storage parameter. key can contain 255 characters at most. value can contain a maximum of 4,000 characters.

skewed_info

SkewedInfo object

Information about values (skewed values) that often appear in a column.

stored_as_sub_directories

Boolean

Whether to store data in subdirectories.

Table 7 Column

Parameter

Type

Description

column_type

String

Column type, including array, bigint, binary, boolean, char, date, decimal, double, float, int, interval, map, set, smallint, string, struct, timestamp, tinyint, union, and varchar.

column_name

String

Column name. The value can contain 1 to 767 characters. Only letters, digits, and special characters (_-+*(),) are allowed.

comment

String

Description of a column. Enter a maximum of 4,000 characters.

Table 8 Order

Parameter

Type

Description

column

String

Column name. The value can contain 1 to 767 characters. Only letters, digits, and special characters (_-+*(),) are allowed.

sort_order

Integer

Sorting method. The values are ==1 (ascending order) and ==0 (descending order).

Table 9 SerDeInfo

Parameter

Type

Description

name

String

Names.

serialization_library

String

Class that implements serialization/deserialization.

parameters

Map<String,String>

Parameters. The value of key ranges from 1 to 255. The maximum value of value is 4000.

Table 10 SkewedInfo

Parameter

Type

Description

skewed_column_names

Array of strings

List of skewed columns.

skewed_column_value_location_maps

Map<String,String>

Mapping between skew values and addresses.

skewed_column_values

Array<Array<String>>

List of skewed values.

Table 11 PagedInfo

Parameter

Type

Description

current_count

Integer

Number of objects returned this time. The value ranges from 0 to 2000.

next_marker

String

Query address of the next page. If the next page does not exist, the value is null. (If the value is null, the response body does not contain this parameter.)

previous_marker

String

Query address of the previous page. If the previous page does not exist, the value is null. (If the value is null, the response body does not contain this parameter.)

Status code: 400

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

solution_msg

String

Solution.

Status code: 404

Table 13 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

solution_msg

String

Solution.

Status code: 500

Table 14 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

solution_msg

String

Solution.

Example Requests

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

Example Responses

Status code: 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
  }
}

Status code: 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"
}

Status code: 401

Unauthorized

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

Status code: 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"
}

Status code: 404

Not Found

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

Status code: 408

Request Timeout

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

Status code: 500

Internal Server Error

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

Status Codes

Status Code

Description

200

OK

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

408

Request Timeout

500

Internal Server Error

Error Codes

See Error Codes.