All Products
Search
Document Center

MaxCompute:GetTableInfo

Last Updated:Dec 16, 2024

Views the information about MaxCompute internal tables, views, external tables, clustered tables, or transactional tables.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
odps:GetTableInfoget
*Project
acs:odps:{#regionId}:{#accountId}:projects/{#ProjectName}
    none
none

Request syntax

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

Request parameters

ParameterTypeRequiredDescriptionExample
projectNamestringYes

The name of the project to which the table or view belongs.

projectA
schemaNamestringNo

The name of the schema to which the table or view belongs.

default
tableNamestringYes

The name of the table or view that you want to view.

sale_detail
typestringNo

The type of the table or view that you want to view. Valid values:

  • internal: internal table
  • external: external table
  • view: view
  • materializedView: materialize view
internal

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

requestIdstring

The request ID.

0a06dd4516687375802853481ec9fd
dataobject

The data returned.

namestring

The name of the table or view.

sale_detail
ownerstring

The account information of the table or view owner.

188785396123****
typestring

The type of the table or view. Valid values:

  • internal: internal table
  • external: external table
  • view: view
  • materializedView: materialize view
internal
schemastring

The name of the schema to which the table or the view belongs.

default
creationTimelong

The creation time.

2022-01-17T07:07:47Z
viewTextstring

The statement that generates the view. This response parameter is returned when type is set to view.

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

The display name.

project_name.schema_name.table_name
projectNamestring

The name of the project to which the table or view belongs.

projectA
lastDDLTimelong

The time when the data definition language (DDL) statement of the table or view was last modified.

2023-11-21T02:05:56Z
lastModifiedTimelong

The time when data of the table or view was last modified.

2023-11-21T02:05:56Z
lastAccessTimelong

The time when data of the table or view was last accessed.

2023-11-21T02:05:56Z
lifecyclestring

The lifecycle. Unit: days.

-1
isExternalTableboolean

Indicates whether the table is an external table. This response parameter is returned when type is set to external.

false
sizelong

The data size of the non-partitioned table. If the table is a partitioned table, the system does not calculate the data size of the table. In this case, the value of this parameter is NULL. The PARTITIONS view includes the data size of each partition in a partitioned table. Unit: bytes.

5372
commentstring

The comments of the table.

sale_detail
tableLabelstring

The sensitivity-level label of the table. For more information, see Label-based access control.

0
createTableDDLstring

DDL statement to create a table.

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

The field information.

nativeColumnobject

The field information.

namestring

The column name.

shop_name
typestring

The column type.

STRING
labelstring

The sensitivity-level label of the column. For more information, see Label-based access control.

0
commentstring

The column comments.

The name of shop.
partitionColumnsarray<object>

The information about partition key columns. This response parameter is returned only for partitioned tables.

partitionColumnobject

The information about the partition key column.

namestring

The partition name.

sale_date
typestring

The partition column type.

STRING
labelstring

The sensitivity-level label of the column. For more information, see Label-based access control.

0
commentstring

The comments of the partition key column.

Sale date.
materializedViewboolean

Indicates whether the table or view is a materialize view.

false
rewriteEnabledboolean

Indicates whether the query rewrite operation can be performed by using the materialized view. This response parameter is returned when type is set to materializedView.

false
autoRefreshEnabledboolean

Indicates whether the materialized view is automatically refreshed. This response parameter is returned when type is set to materializedView.

false
isOutdatedboolean

Indicates whether data of the materialized view is invalid due to changes in the data of the source table. This response parameter is returned when type is set to materializedView.

false
physicalSizelong

The physical size of the table.

2763
fileNumlong

The number of file of the table.

200
storageHandlerstring

The storage handler of the external table. This response parameter is returned when type is set to external.

com.aliyun.odps.CsvStorageHandler
locationstring

The path of the external table. This response parameter is returned when type is set to external.

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

The Alibaba Cloud Resource Name (ARN) of the role AliyunODPSDefaultRole in Resource Access Management (RAM). This response parameter is returned when type is set to external.

acs:ram::xxxxx:role/aliyunodpsdefaultrole
tablestoreColumnsMappingstring

The columns of the Tablestore table to be accessed, including the primary key column and attribute column. This response parameter is returned when type is set to external.

:o_orderkey,:o_orderdate,o_custkey,o_orderstatus,o_totalprice
tablesotreTableNamestring

The name of the Tablestore table to be accessed. This response parameter is returned when type is set to external.

ots_tpch_orders
odpsSqlTextOptionFlushHeaderboolean

Indicates whether the table header is ignored. This response parameter is returned when type is set to external.

true
odpsTextOptionHeaderLinesCountlong

The first N rows that were ignored in the table header. This response parameter is returned when type is set to external.

1
clusterInfoobject

The clustering attribute. This response parameter is returned when the table is a clustered table.

clusterTypestring

The clustering type of the table. MaxCompute supports hash clustering and

range clustering.

Hash
clusterColsarray

The cluster keys.

clusterColsstring

The cluster keys.

col_1
sortColsarray<object>

The condition by which the results are sorted.

sortColsobject

The condition by which the results are sorted.

namestring

The name of the sorting field.

col_2
orderstring

The sorting order.

DESC
bucketNumlong

Optional. The number of buckets in the clustered table. The value 0 indicates that the number of buckets dynamically changes when a job is running.

1024

Examples

Sample success responses

JSONformat

{
  "requestId": "0a06dd4516687375802853481ec9fd",
  "data": {
    "name": "sale_detail",
    "owner": "188785396123****",
    "type": "internal",
    "schema": "default",
    "creationTime": 0,
    "viewText": "select shop_name, sum(total_price) from sale_detail group by shop_name",
    "displayName": "project_name.schema_name.table_name",
    "projectName": "projectA",
    "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": "The name of shop."
      }
    ],
    "partitionColumns": [
      {
        "name": "sale_date",
        "type": "STRING",
        "label": "0",
        "comment": "Sale date."
      }
    ],
    "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

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-11-05The response structure of the API has changedView Change Details