All Products
Search
Document Center

MaxCompute:GetTableInfo - 获取表信息

Last Updated:Aug 20, 2026

查看MaxCompute内部表、视图、外部表、聚簇表或Transactional表的信息。

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

odps:GetTableInfo

get

*Project

acs:odps:{#regionId}:{#accountId}:projects/{#ProjectName}

None None

Request syntax

GET /api/v1/projects/{projectName}/tables/{tableName} HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

projectName

string

Yes

待查看表或视图的所属项目名称。

odps_project

tableName

string

Yes

待查看表或视图的名称。

sale_detail

Request parameters

Parameter

Type

Required

Description

Example

schemaName

string

No

待查看表或视图的所属 Schema 名称。

default

type

string

No

待查看表或视图的类型。取值:

  • internal:内部表。

  • external:外部表。

  • view:视图。

  • materializedView物化视图

internal

Response elements

Element

Type

Description

Example

object

请求返回参数。

requestId

string

请求 ID。

0a06dd4516687375802853481ec9fd

data

object

请求返回结果。

name

string

表或视图名称。

sale_detail

owner

string

表或视图的所有者账号信息。

ALIYUN$odps****@aliyunid.com

type

string

表或视图类型。取值:

  • internal:内部表。

  • external:外部表。

  • view:视图。

  • materializedView物化视图

internal

schema

string

表或视图的所属 Schema 名称。

default

creationTime

integer

创建时间。

2022-01-17T07:07:47Z

viewText

string

生成视图的语句,当类型为视图时有此返回值。

select shop_name, sum(total_price) from sale_detail group by shop_name

displayName

string

展示名称。

odps_project.default.sale_detail

projectName

string

表或视图的所属项目名称。

odps_project

lastDDLTime

integer

表或视图的 DDL 最后变更时间。

2023-11-21T02:05:56Z

lastModifiedTime

integer

表或视图的数据最后变更时间。

2023-11-21T02:05:56Z

lastAccessTime

integer

表或视图的数据最后访问时间,当表为非分区表时有此返回值。

Note

该数据从 2023 年 7 月陆续升级采集,在升级后没有被访问过或者通过 ALGO 作业、Hologres 直读方式访问的无法采集到 last_access_time。

2023-11-21T02:05:56Z

lifecycle

string

生命周期(天)。

-1

isExternalTable

boolean

是否为外部表,当类型为表时有此返回值。

false

size

integer

如果表为非分区表,值为表的数据量大小。如果表为分区表,系统不会计算表的数据量大小,值为 NULL。PARTITIONS 视图中包含分区表各个分区的数据量大小。单位:字节(Byte)。

5372

comment

string

表注释。

sale_detail

tableLabel

string

表的敏感等级标签。更多信息请参见 Label 权限控制

0

createTableDDL

string

创建表的 DDL 语句。

create table if not exists sale_detail( shop_name STRING, customer_id STRING, total_price DOUBLE) partitioned by (sale_date STRING, region STRING);

nativeColumns

array<object>

字段信息。

object

字段信息。

name

string

列名。

shop_name

type

string

数据类型。

STRING

label

string

列的敏感等级标签。更多信息请参见 Label 权限控制

0

comment

string

列注释。

商店名称

partitionColumns

array<object>

分区列信息,分区表才有此返回值。

object

分区列信息。

name

string

分区名。

ds='20190130'

type

string

数据类型。

STRING

label

string

列的敏感等级标签。更多信息请参见 Label 权限控制

0

comment

string

分区列注释。

销售日期

materializedView

boolean

是否为 物化视图

false

rewriteEnabled

boolean

是否允许通过物化视图执行查询改写操作,当类型为物化视图时有此返回值。

false

autoRefreshEnabled

boolean

是否开启自动刷新物化视图,当类型为物化视图时有此返回值。

false

isOutdated

boolean

是否因为源表数据有变化,导致物化视图数据无效,当类型为物化视图时有此返回值。

false

physicalSize

integer

物理大小。

2763

fileNum

integer

文件数量。

200

storageHandler

string

外部表解析器,当类型为外部表时有此返回值。

com.aliyun.odps.CsvStorageHandler

location

string

外部表地址,当类型为外部表时有此返回值。

oss://oss-cn-hangzhou-internal.aliyuncs.com/oss-mc-test/Demo1/

odpsPropertiesRolearn

string

RAM 中 AliyunODPSDefaultRole 的 ARN 信息,当类型为外部表时有此返回值。

acs:ram::xxxxx:role/aliyunodpsdefaultrole

tablestoreColumnsMapping

string

描述 MaxCompute 将访问的 Tablestore 表的列,包括主键和属性列,当类型为外部表时有此返回值。

o_orderkey,o_orderdate,o_custkey,o_orderstatus,o_totalprice

tablesotreTableName

string

需要访问的 Tablestore 表名称,当类型为外部表时有此返回值。

ots_tpch_orders

odpsSqlTextOptionFlushHeader

boolean

是否忽略表头,当类型为外部表时有此返回值。

true

odpsTextOptionHeaderLinesCount

integer

忽略表头前 N 行,当类型为外部表时有此返回值。

1

clusterInfo

object

聚簇属性,当表类型为聚簇表时有此返回值。

clusterType

string

表的聚簇(Clustering)类型,MaxCompute 当前支持 Hash ClusteringRange Clustering两种类型。

Hash

clusterCols

array

聚簇字段(Cluster Key)。

string

聚簇字段(Cluster Key)。

col_1

sortCols

array<object>

排序字段。

object

排序字段。

name

string

排序字段名称。

col_2

order

string

排序方式。

DESC

bucketNum

integer

可选字段,Cluster 表的 Bucket 数目,0 表示作业执行时动态决定。

1024

Examples

Success response

JSON format

{
  "requestId": "0a06dd4516687375802853481ec9fd",
  "data": {
    "name": "sale_detail",
    "owner": "ALIYUN$odps****@aliyunid.com",
    "type": "internal",
    "schema": "default",
    "creationTime": 0,
    "viewText": "select shop_name, sum(total_price) from sale_detail group by shop_name",
    "displayName": "odps_project.default.sale_detail",
    "projectName": "odps_project",
    "lastDDLTime": 0,
    "lastModifiedTime": 0,
    "lastAccessTime": 0,
    "lifecycle": "-1",
    "isExternalTable": false,
    "size": 5372,
    "comment": "sale_detail",
    "tableLabel": "0",
    "createTableDDL": "create table if not exists sale_detail( shop_name STRING, customer_id STRING, total_price DOUBLE) partitioned by (sale_date STRING, region STRING);",
    "nativeColumns": [
      {
        "name": "shop_name",
        "type": "STRING",
        "label": "0",
        "comment": "商店名称"
      }
    ],
    "partitionColumns": [
      {
        "name": "ds='20190130'",
        "type": "STRING",
        "label": "0",
        "comment": "销售日期"
      }
    ],
    "materializedView": false,
    "rewriteEnabled": false,
    "autoRefreshEnabled": false,
    "isOutdated": false,
    "physicalSize": 2763,
    "fileNum": 200,
    "storageHandler": "com.aliyun.odps.CsvStorageHandler",
    "location": "oss://oss-cn-hangzhou-internal.aliyuncs.com/oss-mc-test/Demo1/",
    "odpsPropertiesRolearn": "acs:ram::xxxxx:role/aliyunodpsdefaultrole",
    "tablestoreColumnsMapping": "o_orderkey,o_orderdate,o_custkey,o_orderstatus,o_totalprice",
    "tablesotreTableName": "ots_tpch_orders",
    "odpsSqlTextOptionFlushHeader": true,
    "odpsTextOptionHeaderLinesCount": 1,
    "clusterInfo": {
      "clusterType": "Hash",
      "clusterCols": [
        "col_1"
      ],
      "sortCols": [
        {
          "name": "col_2",
          "order": "DESC"
        }
      ],
      "bucketNum": 1024
    }
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.