CreateTable - 创建一个MaxCompute表

更新时间:
复制 MD 格式

创建一个MaxCompute的表。

说明

目前该API接口已标记为弃用。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

当前API暂无授权信息透出。

请求参数

名称

类型

必填

描述

示例值

IsView

integer

否

指定创建视图或创建表:

  • 0 为创建表。

  • 1 为创建视图。

0

Visibility

integer

否

表或工作空间是否可见:

  • 0 为表和工作空间均不可见。

  • 1 为表和工作空间均可见。

  • 2 为仅工作空间可见。

1

LifeCycle

integer

否

表的生命周期,单位为天。默认取值为空,表示永久存储。

10

CategoryId

integer

否

关联类目的 ID。您可以通过 GetMetaCategory 接口查询可以关联的类目 ID。

101

LogicalLevelId

integer

否

逻辑层级 ID。

101

PhysicsLevelId

integer

否

物理层级 ID。

101

ExternalTableType

string

否

外部表的存储类型。取值如下:

  • 0 表示 OSS。

  • 1 表示 TableStore。

  • 2 表示 Volume。

  • 3 表示 MySQL。

0

Location

string

否

外部表的存储地址。

location

ProjectId

integer

否

DataWorks 工作空间的 ID。

23

TableName

string

是

表的名称。

tableName1

Endpoint

string

否

MaxCompute 的 Endpoint。

odps://abc

EnvType

integer

否

DataWorks 工作空间的环境。取值如下:

  • 0 表示开发环境。

  • 1 表示生产环境。

1

AppGuid

string

否

MaxCompute 项目的 ID,格式为 odps.{projectName}。

odps.test

Comment

string

否

备注信息。

备注

HasPart deprecated

integer

否

创建的 MaxCompute 表是否为分区表,包括 1(是)和 0(否)。该字段已废弃,请勿使用。 目前代码会根据 Column.N.isPartitionCol 参数判断 MaxCompute 表是否为分区表,当 Column.N.isPartitionCol 参数取值为 true 时,则认为 MaxCompute 表为分区表。

0

ClientToken

string

否

保留字段。

保留字段

Schema

string

否

表 Schema 信息。在 ODPS,当您启动了三层模型时需要填写 Schema 信息。

default

Columns

array<object>

是

字段列表,最大支持 1000 个字段。

object

否

字段对象

ColumnNameCn

string

否

字段的中文名称。

中文名

ColumnName

string

是

字段的名称。 CreateTable API 当前最多支持配置 1000 个字段。

columnName1

Comment

string

否

字段的备注信息。

备注

ColumnType

string

是

字段的类型。此处支持的字段类型,取决于您 MaxCompute 项目使用的数据类型版本,各版本支持的数据类型请参见数据类型版本说明。

string

SeqNumber

integer

否

字段的序列号。您可以指定字段在表中的排序,默认按照创建请求的顺序排序。 如果字段为分区字段,则不支持配置 Columns.N.SeqNumber。

1

Length

integer

否

字段的长度,详情请参见:数据类型版本。

10

IsPartitionCol

boolean

否

当前字段是否为分区字段。

true

Themes

array<object>

否

字段列表

object

否

返回对象

ThemeId

integer

否

主题 ID。

101

ThemeLevel

integer

否

主题 ID 对应的主题层级。

101

返回参数

名称

类型

描述

示例值

object

返回对象

RequestId

string

请求 ID。

abcdef

TaskInfo

object

请求任务的信息。 请求任务提交成功后,会被分为多个子任务有序执行。当前子任务执行成功后,才会继续执行下一个子任务,所有子任务执行完毕,该请求任务结束。

如下情况,请求任务会终止,您需要根据错误码信息解决问题后重新发起请求任务:

  • 请求任务提交失败。

  • 请求任务提交成功后,任意子任务执行失败。

Status

string

当前执行的子任务的状态信息。取值如下:

  • operating 表示子任务正在执行中。

  • success 表示子任务执行成功。

  • failure 表示子任务执行失败。详细的报错信息请参见 Content 参数。

success

NextTaskId

string

即将执行的子任务 ID。如果该字段为空,则表示所有子任务均已结束。

abc1

TaskId

string

当前执行的子任务 ID。

abc

Content

string

当前子任务的执行状态详细信息。具体如下:

  • 执行成功,则显示 success。

  • 执行失败则显示对应的报错详情。

success

示例

正常返回示例

JSON格式

{
  "RequestId": "abcdef",
  "TaskInfo": {
    "Status": "success",
    "NextTaskId": "abc1",
    "TaskId": "abc",
    "Content": "success"
  }
}

错误码

HTTP status code

错误码

错误信息

描述

500 InternalError.System An internal system error occurred. Try again later.
500 InternalError.UserId.Missing An internal system error occurred. Try again later.
403 Forbidden.Access Access is forbidden. Please first activate DataWorks Enterprise Edition or Flagship Edition.
429 Throttling.Api The request for this resource has exceeded your available limit.
429 Throttling.Api.Risk The request for this resource has exceeded your daily available limit.
429 Throttling.System The DataWorks system is busy. Try again later.
429 Throttling.User Your request is too frequent. Try again later.

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情。