Creates a MaxCompute table or view.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateTable

The operation that you want to perform.

Columns.N.ColumnName String Yes columnName1

The name of the field.

A maximum of 100 fields can be configured for the CreateTable API operation.

Columns.N.ColumnType String Yes string

The data type of the field.

RegionId String Yes cn-shanghai

The region ID. For example, the ID of the China (Shanghai) region is cn-shanghai, and that of the China (Zhangjiakou) region is cn-zhangjiakou. The system automatically determines the value of this parameter based on the endpoint used to call the operation.

TableName String Yes tableName1

The name of the table.

Columns.N.ColumnNameCn String No Display name

The display name of the field.

Columns.N.SeqNumber Integer No 1

The sequence number of the field. You can use this parameter to specify how fields are sorted in a table. By default, fields are sorted in the order in which requests are created.

If the field is a partition field, this parameter is not supported.

Columns.N.Length Integer No 10

The length of the field.

Columns.N.IsPartitionCol Boolean No 0

Specifies whether the current field is a partition field. Valid values:

  • 1: The current field is a partition field.
  • 0: The current field is not a partition field.
Columns.N.Comment String No Comment

The comment of the field.

IsView Integer No 0

Specifies whether to create a view or table.

  • 0: Create a table.
  • 1: Create a view.
Visibility Integer No 1

Specifies whether the table or workspace is visible:

  • 0: Neither the table nor workspace is visible.
  • 1: The table and workspace are visible.
  • 2: Only the workspace is visible.
LifeCycle Integer No 10

The lifecycle of the table. By default, this parameter is left empty, which indicates that the table is permanently stored.

CategoryId Long No 101

The ID of the category that can be associated. You can call the GetMetaCategory operation to query the ID of the category that can be associated.

LogicalLevelId Long No 101

The ID of the logical level.

PhysicsLevelId Long No 101

The ID of the physical level.

ExternalTableType String No 0

The storage type of the external table. Valid values:

  • 0: OSS
  • 1: Tablestore
  • 2: Volume
  • 3: MySQL
Location String No location

The storage location of the external table.

ProjectId Long No 23

The ID of the DataWorks workspace.

Endpoint String No odps://abc

The endpoint of MaxCompute.

EnvType Integer No 1

The environment type of the DataWorks workspace. Valid values:

  • 0: development environment
  • 1: production environment
Themes.N.ThemeId Long No 101

The ID of the topic.

Themes.N.ThemeLevel Integer No 101

The level that corresponds to the topic ID.

AppGuid String No odps.test

The ID of the MaxCompute project. The value of this parameter is in the odps.{projectName} format.

Comment String No Comment

The comment.

HasPart Integer No 0

Specifies whether the MaxCompute table is a partitioned table. Valid values: 1 and 0. The value 1 indicates that the MaxCompute table is a partitioned table. The value 0 indicates that the MaxCompute table is not a partitioned table. This parameter is deprecated. Do not use this parameter.

The code determines whether a MaxCompute table is a partitioned table based on the Column.N.isPartitionCol parameter. If the Column.N.isPartitionCol parameter is set to 1, the MaxCompute table is a partitioned table.

ClientToken String No Reserved parameter

A reserved parameter.

Response parameters

Parameter Type Example Description
RequestId String abcdef

The ID of the request.

TaskInfo Struct

The information about the request task.

After a request task is submitted, it is split into multiple subtasks that are run in sequence. After the current subtask is completed, the next subtask starts to run. After all subtasks are completed, the request task is completed.

If a request task is aborted due to one of the following issues, address the issue based on the error code and initiate the request task again:

  • The request task fails to be submitted.
  • After the request task is submitted, a subtask fails to run.
Content String success

Details about the status of the current subtask.

  • If the current subtask succeeds, success is returned.
  • If the current subtask fails, the error details are displayed.
NextTaskId String abc1

The ID of the subtask that you want to run. If this parameter is empty, all subtasks are completed. You can call the GetDDLJobStatus operation to query the status of the subtask based on the subtask ID.

Status String success

The status of the current subtask. Valid values:

  • operating: The subtask is running.
  • success: The subtask succeeds.
  • failure: The subtask fails. For detailed error information, see the Content parameter.
TaskId String abc

The ID of the current subtask.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateTable
&Columns.1.ColumnName=columnName1
&Columns.1.ColumnType=string
&HasPart=0
&RegionId=cn-shanghai
&TableName=tableName1
&<Common request parameters>

Sample success responses

XML format

<TaskInfo>
    <Status>success</Status>
    <TaskId>abc</TaskId>
    <Content>success</Content>
    <NextTaskId>abc1</NextTaskId>
</TaskInfo>
<RequestId>abcdef</RequestId>

JSON format

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

Error codes

HttpCode Error code Error message Description
500 InternalError.System An internal system error occurred. Try again later. The error message returned because an internal error has occurred. Try again later.
500 InternalError.UserId.Missing An internal system error occurred. Try again later. The error message returned because an internal error has occurred. Try again later.
429 Throttling.Api The request for this resource has exceeded your available limit. The error message returned because the number of requests for the resource has exceeded the upper limit.
429 Throttling.Api.Risk The request for this resource has exceeded your daily available limit. The error message returned because the number of requests per day for the resource has exceeded the upper limit.
429 Throttling.System The DataWorks system is busy. Try again later. The error message returned because the DataWorks system is busy. Try again later.
429 Throttling.User Your request is too frequent. Try again later. The error message returned because excessive requests have been submitted within a short period of time. Try again later.
403 Forbidden.Access Access is forbidden. Please first activate DataWorks Enterprise Edition or Flagship Edition. The error message returned because you are not allowed to perform this operation. Activate DataWorks Enterprise Edition or DataWorks Ultimate Edition.

For a list of error codes, visit the API Error Center.