查看MaxCompute内部表、视图、外部表、聚簇表或Transactional表的信息。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
odps:GetTableInfo |
get |
*Project
|
无 | 无 |
请求语法
GET /api/v1/projects/{projectName}/tables/{tableName} HTTP/1.1
路径参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| projectName |
string |
是 |
待查看表或视图的所属项目名称。 |
odps_project |
| tableName |
string |
是 |
待查看表或视图的名称。 |
sale_detail |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| schemaName |
string |
否 |
待查看表或视图的所属 Schema 名称。 |
default |
| type |
string |
否 |
待查看表或视图的类型。取值:
|
internal |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
请求返回参数。 |
||
| requestId |
string |
请求 ID。 |
0a06dd4516687375802853481ec9fd |
| data |
object |
请求返回结果。 |
|
| name |
string |
表或视图名称。 |
sale_detail |
| owner |
string |
表或视图的所有者账号信息。 |
ALIYUN$odps****@aliyunid.com |
| type |
string |
表或视图类型。取值:
|
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 |
表或视图的数据最后访问时间,当表为非分区表时有此返回值。 说明
该数据从 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 Clustering 和 Range 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 |
示例
正常返回示例
JSON格式
{
"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
}
}
}
错误码
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。