Creates a MaxCompute table.

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 Required CreateTable

The operation that you want to perform.

Columns.N.ColumnName String Required columnName1

The name of the field to be sampled.

Columns.N.ColumnType String Required string

The type of the field.

HasPart Integer Yes 0

Indicates whether the table is partitioned. A value of 1 indicates that the table is partitioned. A value of 0 indicates that the table is not partitioned.

RegionId String Required cn-shanghai

The ID of the region where the production studio resides.

TableName String Required tableName1

The name of the table.

Columns.N.ColumnNameCn String No Display Name

The Chinese name of the field.

Columns.N.SeqNumber Integer No 1

The serial number of the field.

Columns.N.Length Integer No 10

The length of the field.

Columns.N.IsPartitionCol Integer No 0

Indicates whether the field is partitioned. The value 1 indicates that the field is partitioned. The value 0 indicates that the field is not partitioned.

Columns.N.IsPrimaryKey Integer No 0

Indicates whether the column is a primary key. A value of 1 indicates a primary key. A value of 2 indicates a non-primary key.

Columns.N.IsNullable Integer No 1

Null is allowed or not: 1 indicates that the query is allowed. 0 indicates that the query is not allowed.

Columns.N.Comment String No Remarks

The description of the field.

IsView Integer No 0

Whether it is a view: 0 is not, 1 is yes.

Visibility Integer No 1

Visible: 0 indicates that the table is invisible, 1 indicates that the table is visible, and 2 indicates that the workspace is visible.

LifeCycle Integer No 10

The lifecycle of a table. Permanent storage when lifecycle is empty.

CategoryId Long No 101

The ID of the associated class.

LogicalLevelId Long No 101

Logical level ID.

PhysicsLevelId Long No 101

The ID of the physical level.

ExternalTableType String No 0

The type of the external table. Valid values: 0(OSS), 1 (table store), 2(Volume), and 3(MySQL).

Location String No location

The storage address 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

DataWorks the environment of the workspace, including 0 (Development Environment) and 1 (production environment).

Themes.N.ThemeId Long No 101

The ID of the topic.

Themes.N.ThemeLevel Integer No 101

The level of the topic to which the topic ID belongs.

AppGuid String No odps.test

The unique ID of the MaxCompute project, in the format of odps.{projectName}.

Response parameters

Parameter Type Example Description
RequestId String abcdef

The ID of the request.

TaskInfo Struct

The information about the task.

Content String success

The information about the task.

NextTaskId String abc1

The information of a running task. If you do not specify the parameter, the tasks have all ended. You can use the TaskID object to query the status of the task.

Status String success

The status of the completed task (corresponding to the TaskId field).

TaskId String abc

The ID of the completed task.

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 code

HttpCode Error code Error message Description
403 Forbidden.Access Access is forbidden. Activate DataWorks first. Your access is restricted, possibly because you have not activated DataWorks.
500 InternalError.System An internal system error occurred. Try again later. An internal system error occurred. Please try again later.
500 InternalError.UserId.Missing An internal system error occurred. Try again later. An internal system error occurred. Please try again later.
403 ResourceNotAuthorized.Api You are not authorized to access the resources. You cannot access resources without authorization.
429 Throttling.Api The request for this resource has exceeded your available limit. The request for the resource exceeds your available upper limit.
429 Throttling.Api.Risk The request for this resource has exceeded your daily available limit. The request for the resource has exceeded your daily availability limit.
429 Throttling.System The DataWorks system is busy. Try again later. DataWorks the system is busy, please try again later.
429 Throttling.User Your request is too frequent. Try again later. Your request is too frequent, please try to slow down the request speed.

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