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.

Columns.N.ColumnType String Yes string

The type of the field.

HasPart Integer Yes 0

Whether the created MaxCompute table is partition table:

  • 1 is a partition table.
  • 0 Non-partition table.
RegionId String Yes cn-shanghai

The information about the region, which is usually the region where the service is located. For example, China (Shanghai) is cn-shanghai, and China (Zhangjiakou) is cn-zhangjiakou. You do not need to specify the RegionId because it is automatically resolved based on the Endpoint that is called.

TableName String Yes tableName1

The name of the table.

Columns.N.ColumnNameCn String No Display Name

The alias of the field.

Columns.N.SeqNumber Integer No 1

The serial number of the field. You can specify the sorting order of the fields in the table. By default, fields are sorted in the order they were created.

Columns.N.Length Integer No 10

The length of the field.

Columns.N.IsPartitionCol Integer No 0

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

  • 1: The Partition field.
  • 0 is a non-partitioning field.
Columns.N.IsPrimaryKey Integer No 0

Indicates whether the current field is the primary key. Valid values:

  • 1 is the primary key.
  • 0 is a non-primary key.
Columns.N.IsNullable Integer No 1

Specifies whether to allow the current field to be empty. Valid values:

  • 1: allowed.
  • 0 is not allowed.
Columns.N.Comment String No Remarks

The description of the field.

IsView Integer No 0

Specify to create a view or create a table:

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

Whether the table or workspace is visible:

  • 0 for tables and workspaces are not visible.
  • 1 indicates that both tables and workspaces can be viewed.
  • 2 is visible only to the workspace.
LifeCycle Integer No 10

The lifecycle of the table. The default value is null, indicating permanent storage.

CategoryId Long No 101

The ID of the associated class. You can GetMetaCategory The ID of the category that can be associated with the API.

LogicalLevelId Long No 101

Logical level ID.

PhysicsLevelId Long No 101

The ID of the physical level.

ExternalTableType String No 0

The storage class of the foreign table. Valid values:

  • 0 indicates OSS.
  • 1 indicates TableStore.
  • 2: Volume.
  • 3 indicates MySQL.
Location String No location

The storage path 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. Valid values:

  • 0: development environment.
  • 1 indicates the 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. You can ListTableTheme Interface to query by topic.

AppGuid String No odps.test

The MaxCompute Project ID in the format of odps.{projectName}.

Comment String No Remarks

The description of the RAM user group.

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 successfully, it is divided into multiple subtasks and executed sequentially. After the current subtask is successfully executed, the execution of the next subtask continues. After all subtasks are executed, the request task is completed.

The request is terminated under the following circumstances. You must solve the problem based on the error code information before initiating a new request task.

  • The request task submission failed.
  • After the request task is submitted successfully, any subtask fails to be executed.
Content String success

The execution status of the current subtask. No further configuration is required.

  • If the execution is successful, the message success is displayed.
  • If the operation fails, the corresponding error details are displayed.
NextTaskId String abc1

The ID of the subtask to be executed. If this field is empty, all subtasks have been completed. You can use the obtained ID, retrieved from GetDDLJobStatus Interface to query the status of the corresponding subtask.

Status String success

The status of the currently executed subtask. Valid values:

  • operating indicates that the subtask is being executed.
  • success indicates that the subtask is successful.
  • failure: The subtask fails to be executed. For more information, see Content parameter.
TaskId String abc

The ID of the currently executed 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 codes Error message Description
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.

Go to the Error CenterFor more information, see error codes.