调用GetMetaTablePartition获取表的分区列表。

仅支持获取MaxCompute和EMR两种引擎表的分区列表。

调试

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

请求参数

名称 类型 是否必选 示例值 描述
Action String GetMetaTablePartition

系统规定参数。取值:GetMetaTablePartition

PageNumber Integer 1

请求的数据页数,用于翻页。

PageSize Integer 10

每页显示的条数,默认为10条,最大100条。

TableGuid String odps.engine_name.table_name

表的唯一标识。

ClusterId String abc

EMR集群的ID,仅当数据类型为EMR时,需要配置该参数。

您可以登录EMR的控制台,获取集群ID。

DatabaseName String abc

数据库的名称。仅当数据类型为EMR时,需要配置该参数。

您可以调用ListMetaDB接口获取。

TableName String abc

EMR的表名称。仅当数据类型为EMR时,需要配置该参数。

您可以通过调用GetMetaDBTableList接口,获取表名称。

DataSourceType String emr

数据类型,支持ODPS或者EMR。

SortCriterion Object

表分区的排序逻辑。

SortField String name

表分区的排序字段。您可通过name、modify_time排序。

默认按照表分区的创建时间排序。

Order String desc

表分区的排序顺序,支持使用asc、desc方式排序。默认使用desc。

返回数据

名称 类型 示例值 描述
HttpStatusCode Integer 200

HTTP状态码。

ErrorMessage String The connection does not exist.

错误信息。

RequestId String 0bc1ec92159376

请求ID。

Success Boolean true

请求是否成功。

ErrorCode String Invalid.Tenant.ConnectionNotExists

错误码。

Data Object

业务数据。

PageNumber Integer 1

请求的数据页数,用于翻页。

PageSize Integer 10

每页显示的条数,默认为10条,最大100条。

TotalCount Long 100

分区的总数。

DataEntityList Array of DataEntityList

实例列表。

PartitionPath String abc

分区的目录。

DataSize Long 19

分区的大小,单位为Byte。

PartitionName String pt=20170614

分区的名称。

Comment String 备注

备注信息。

ModifiedTime Long 1590032868000

修改分区的时间,单位为毫秒。

CreateTime Long 1590032868000

创建分区的时间,单位为毫秒。

RecordCount Long 233

分区的数据量。

PartitionType String abc

分区的类型。

PartitionGuid String odps.engine_name.table_name.pt=20170614

分区的唯一标识。

PartitionLocation String abc

Hive分区的地址。

TableGuid String odps.engine_name.table_name

表的唯一标识。

示例

请求示例

http(s)://[Endpoint]/?Action=GetMetaTablePartition
&PageNumber=1
&PageSize=10
&TableGuid=odps.engine_name.table_name
&ClusterId=abc
&DatabaseName=abc
&TableName=abc
&DataSourceType=emr
&SortCriterion={"SortField":"name","Order":"desc"}
&公共请求参数

正常返回示例

XML格式

HTTP/1.1 200 OK
Content-Type:application/xml

<GetMetaTablePartitionResponse>
    <HttpStatusCode>200</HttpStatusCode>
    <ErrorMessage>The connection does not exist.</ErrorMessage>
    <RequestId>0bc1ec92159376</RequestId>
    <Success>true</Success>
    <ErrorCode>Invalid.Tenant.ConnectionNotExists</ErrorCode>
    <Data>
        <PageNumber>1</PageNumber>
        <PageSize>10</PageSize>
        <TotalCount>100</TotalCount>
        <DataEntityList>
            <PartitionPath>abc</PartitionPath>
            <DataSize>19</DataSize>
            <PartitionName>pt=20170614</PartitionName>
            <Comment>备注</Comment>
            <ModifiedTime>1590032868000</ModifiedTime>
            <CreateTime>1590032868000</CreateTime>
            <RecordCount>233</RecordCount>
            <PartitionType>abc</PartitionType>
            <PartitionGuid>odps.engine_name.table_name.pt=20170614</PartitionGuid>
            <PartitionLocation>abc</PartitionLocation>
            <TableGuid>odps.engine_name.table_name</TableGuid>
        </DataEntityList>
    </Data>
</GetMetaTablePartitionResponse>

JSON格式

HTTP/1.1 200 OK
Content-Type:application/json

{
  "HttpStatusCode" : 200,
  "ErrorMessage" : "The connection does not exist.",
  "RequestId" : "0bc1ec92159376",
  "Success" : true,
  "ErrorCode" : "Invalid.Tenant.ConnectionNotExists",
  "Data" : {
    "PageNumber" : 1,
    "PageSize" : 10,
    "TotalCount" : 100,
    "DataEntityList" : {
      "PartitionPath" : "abc",
      "DataSize" : 19,
      "PartitionName" : "pt=20170614",
      "Comment" : "备注",
      "ModifiedTime" : 1590032868000,
      "CreateTime" : 1590032868000,
      "RecordCount" : 233,
      "PartitionType" : "abc",
      "PartitionGuid" : "odps.engine_name.table_name.pt=20170614",
      "PartitionLocation" : "abc",
      "TableGuid" : "odps.engine_name.table_name"
    }
  }
}

错误码

HttpCode 错误码 错误信息 描述
400 InvalidParameter.Meta.CommonError The specified parameter is invalid. 请求参数错误。
400 InvalidParameter.Meta.Illegal The app guid parameter is invalid. App参数错误。
400 InvalidParameter.Meta.IllegalDate The date format is invalid. 日期格式错误。
400 InvalidParameter.Meta.IllegalPageError The parameter for paging is invalid. 分页信息错误。
400 InvalidParameter.Meta.NotExist The object does not exist. 数据不存在。
403 Forbidden.Meta.NoTenant The user is not the owner of any tenants. 当前的用户不是任何租户的所有者。
403 Forbidden.Access Access is forbidden. Please first activate DataWorks Enterprise Edition or Flagship Edition. 您被限制访问,请开通DataWorks企业版或旗舰版。
429 Throttling.Api The request for this resource has exceeded your available limit. 对该资源的请求已超过您的可用上限。
429 Throttling.Api.Risk The request for this resource has exceeded your daily available limit. 对该资源的请求已超过您的每日可用上限。
429 Throttling.System The DataWorks system is busy. Try again later. DataWorks系统繁忙,请稍后再试。
429 Throttling.User Your request is too frequent. Try again later. 您的请求过于频繁,请尝试放缓请求速度。
500 InternalError.System An internal system error occurred. Try again later. 系统内部错误,请稍后再试。
500 InternalError.UserId.Missing An internal system error occurred. Try again later. 系统内部错误,请稍后再试。
500 InternalError.Meta.NoCalcEngine An error occurred while retrieving the compute engine based on the MaxCompute project. 根据ODPS项目获取计算引擎失败。
500 InternalError.Meta.TenantTimeOut Failed to connect to the interface network. 接口网络不通。
500 InternalError.Meta.Unknown An unknown error occurred while processing your request. 未知错误。

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

GetMetaTablePartition接口的使用示例Demo请参见DataWorks OpenAPI示例