GetTableInfo

Updated at:

Queries 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 to be queried belongs.

odps_project

tableName

string

Yes

The name of the table or view to be queried.

sale_detail

Request parameters

Parameter

Type

Required

Description

Example

schemaName

string

No

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

default

type

string

No

The type of the table or view to be queried. Valid values:

  • internal: Internal table.

  • external: External table.

  • view: View.

  • materializedView: Materialized view .

internal

Response elements

Element

Type

Description

Example

object

The response parameters.

requestId

string

The request ID.

0a06dd4516687375802853481ec9fd

data

object

The response result.

name

string

The name of the table or view.

sale_detail

owner

string

The account information of the owner of the table or view.

ALIYUN$odps****@aliyunid.com

type

string

The type of the table or view. Valid values:

  • internal: Internal table.

  • external: External table.

  • view: View.

  • materializedView: Materialized view .

internal

schema

string

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

default

creationTime

integer

The creation time. The time is in ISO 8601 format and in the UTC time zone.

2022-01-17T07:07:47Z

viewText

string

The statement used to create the view. This parameter is returned only when the type is view.

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

displayName

string

The display name.

odps_project.default.sale_detail

projectName

string

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

odps_project

lastDDLTime

integer

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

2023-11-21T02:05:56Z

lastModifiedTime

integer

The time when the data of the table or view was last modified. The time is in ISO 8601 format and in the UTC time zone.

2023-11-21T02:05:56Z

lastAccessTime

integer

The time when the data of the table or view was last accessed. This parameter is returned only when the table is a non-partitioned table.

Note

This data has been gradually collected since July 2023. If the table has not been accessed after the upgrade, or if it is accessed through ALGO jobs or Hologres direct read, the last_access_time cannot be collected.

2023-11-21T02:05:56Z

lifecycle

string

The lifecycle in days.

-1

isExternalTable

boolean

Indicates whether the table is an external table. This parameter is returned only when the type is table.

false

size

integer

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

5372

comment

string

The table comment.

sale_detail

tableLabel

string

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

0

createTableDDL

string

The DDL statement used to create the 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 column information.

object

The column information.

name

string

The column name.

shop_name

type

string

The data type.

STRING

label

string

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

0

comment

string

The column comment.

Store name

partitionColumns

array<object>

The partition column information. This parameter is returned only for partitioned tables.

object

The partition column information.

name

string

The partition name.

ds='20190130'

type

string

The data type.

STRING

label

string

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

0

comment

string

The partition column comment.

Sale date

materializedView

boolean

Indicates whether the table is a materialized view .

false

rewriteEnabled

boolean

Indicates whether query rewrite through the materialized view is allowed. This parameter is returned only when the type is materialized view.

false

autoRefreshEnabled

boolean

Indicates whether automatic refresh of the materialized view is enabled. This parameter is returned only when the type is materialized view.

false

isOutdated

boolean

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

false

physicalSize

integer

The physical size.

2763

fileNum

integer

The number of files.

200

storageHandler

string

The external table parser. This parameter is returned only when the type is external table.

com.aliyun.odps.CsvStorageHandler

location

string

The external table location. This parameter is returned only when the type is external table.

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

odpsPropertiesRolearn

string

The ARN of AliyunODPSDefaultRole in RAM. This parameter is returned only when the type is external table.

acs:ram::xxxxx:role/aliyunodpsdefaultrole

tablestoreColumnsMapping

string

The columns of the Tablestore table to be accessed by MaxCompute, including the primary key columns and attribute columns. This parameter is returned only when the type is external table.

o_orderkey,o_orderdate,o_custkey,o_orderstatus,o_totalprice

tablesotreTableName

string

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

ots_tpch_orders

odpsSqlTextOptionFlushHeader

boolean

Indicates whether to ignore the header. This parameter is returned only when the type is external table.

true

odpsTextOptionHeaderLinesCount

integer

The number of header lines to ignore. This parameter is returned only when the type is external table.

1

clusterInfo

object

The clustering properties. This parameter is returned only when the table type is clustered table.

clusterType

string

The clustering type of the table. MaxCompute currently supports Hash Clustering and Range Clustering .

Hash

clusterCols

array

The cluster key.

string

The cluster key.

col_1

sortCols

array<object>

The sort columns.

object

The sort columns.

name

string

The name of the sort column.

col_2

order

string

The sort order.

DESC

bucketNum

integer

The number of buckets in the clustered table. This is an optional field. A value of 0 indicates that the number of buckets is dynamically determined during job execution.

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": "Store name"
      }
    ],
    "partitionColumns": [
      {
        "name": "ds='20190130'",
        "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.