GetTableInfo

Updated at:

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

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

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

projectA

tableName

string

Yes

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

sale_detail

Request parameters

Parameter

Type

Required

Description

Example

schemaName

string

No

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

default

type

string

No

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 elements

Element

Type

Description

Example

object

The response parameters.

requestId

string

The request ID.

0a06dd4516687375802853481ec9fd

data

object

The data returned.

name

string

The name of the table or view.

sale_detail

owner

string

The account information of the table or view owner.

188785396123****

type

string

The type of the table or view. Valid values:

  • internal: internal table

  • external: external table

  • view: view

  • materializedView: materialize view

internal

schema

string

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

default

creationTime

integer

The creation time.

2022-01-17T07:07:47Z

viewText

string

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

displayName

string

The display name.

project_name.schema_name.table_name

projectName

string

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

projectA

lastDDLTime

integer

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

2023-11-21T02:05:56Z

lastModifiedTime

integer

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

2023-11-21T02:05:56Z

lastAccessTime

integer

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

2023-11-21T02:05:56Z

lifecycle

string

The lifecycle. Unit: days.

-1

isExternalTable

boolean

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

false

size

integer

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

comment

string

The comments of the table.

sale_detail

tableLabel

string

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

0

createTableDDL

string

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);

nativeColumns

array<object>

The field information.

object

The field information.

name

string

The column name.

shop_name

type

string

The column type.

STRING

label

string

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

0

comment

string

The column comments.

The name of shop.

partitionColumns

array<object>

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

object

The information about the partition key column.

name

string

The partition name.

sale_date

type

string

The partition column type.

STRING

label

string

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

0

comment

string

The comments of the partition key column.

Sale date.

materializedView

boolean

Indicates whether the table or view is a materialize view.

false

rewriteEnabled

boolean

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

autoRefreshEnabled

boolean

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

false

isOutdated

boolean

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

physicalSize

integer

The physical size of the table.

2763

fileNum

integer

The number of file of the table.

200

storageHandler

string

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

com.aliyun.odps.CsvStorageHandler

location

string

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/

odpsPropertiesRolearn

string

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

tablestoreColumnsMapping

string

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

tablesotreTableName

string

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

ots_tpch_orders

odpsSqlTextOptionFlushHeader

boolean

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

true

odpsTextOptionHeaderLinesCount

integer

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

1

clusterInfo

object

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

clusterType

string

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

range clustering.

Hash

clusterCols

array

The cluster keys.

string

The cluster keys.

col_1

sortCols

array<object>

The condition by which the results are sorted.

object

The condition by which the results are sorted.

name

string

The name of the sorting field.

col_2

order

string

The sorting order.

DESC

bucketNum

integer

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

Success response

JSON format

{
  "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

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.