CreateTable

Updated at:

Creates a MaxCompute table.

Note

This API has been deprecated with no replacement. While temporary access is maintained, no further updates or bug fixes will be provided. To ensure continued functionality, plan your migration and contact your account manager for support.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

IsView

integer

No

Specifies whether to create a view or a table. Valid values:

  • 0: Table.

  • 1: View.

0

Visibility

integer

No

Specifies the visibility of the table or workspace. Valid values:

  • 0: Invisible at both the table and workspace levels.

  • 1: Visible at both the table and workspace levels.

  • 2: Visible only at the workspace level.

1

LifeCycle

integer

No

The lifecycle of the table, in days. The default value is empty, which indicates permanent storage.

10

CategoryId

integer

No

The ID of the associated category. You can call the GetMetaCategory operation to query the IDs of available categories.

101

LogicalLevelId

integer

No

The ID of the logical level.

101

PhysicsLevelId

integer

No

The ID of the physical level.

101

ExternalTableType

string

No

The storage type of the external table. Valid values:

  • 0: OSS.

  • 1: Tablestore.

  • 2: Volume.

  • 3: MySQL.

0

Location

string

No

The storage address of the external table.

location

ProjectId

integer

No

The ID of the DataWorks workspace.

23

TableName

string

Yes

The name of the table.

tableName1

Endpoint

string

No

The endpoint of MaxCompute.

odps://abc

EnvType

integer

No

The environment of the DataWorks workspace. Valid values:

  • 0: Development environment.

  • 1: Production environment.

1

AppGuid

string

No

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

odps.test

Comment

string

No

The comment.

Comment

HasPart deprecated

integer

No

Specifies whether the MaxCompute table to be created is a partitioned table. Valid values: 1 (yes) and 0 (no). [Deprecated] Do not use this parameter. Currently, the system 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 true, the MaxCompute table is considered a partitioned table.

0

ClientToken

string

No

The reserved field.

Reserved field

Schema

string

No

The table schema. For MaxCompute, specify this information if the three-layer model is enabled.

default

Columns

array<object>

Yes

The list of columns. You can specify up to 1,000 columns.

object

No

The field object.

ColumnNameCn

string

No

The Chinese name of the field.

中文名

ColumnName

string

Yes

The column name. The CreateTable operation supports up to 1,000 columns.

columnName1

Comment

string

No

The comment of the field.

Comment

ColumnType

string

Yes

The data type of the field. The supported data types depend on the data type edition used by your MaxCompute project. For more information about the data types supported by each edition, see Data type editions.

string

SeqNumber

integer

No

The sequence number of the field. You can specify the order of fields in the table. By default, fields are sorted in the order they are specified in the creation request. If the field is a partition field, you cannot configure the Columns.N.SeqNumber parameter.

1

Length

integer

No

The length of the field. For more information, see Data type editions.

10

IsPartitionCol

boolean

No

Indicates whether this is a partition column.

true

Themes

array<object>

No

The list of themes.

object

No

The returned object.

ThemeId

integer

No

The ID of the theme.

101

ThemeLevel

integer

No

The theme level corresponding to the theme ID.

101

Response elements

Element

Type

Description

Example

object

The returned object.

RequestId

string

The ID of the request.

abcdef

TaskInfo

object

The information about the request task. After a request task is submitted, it is divided into multiple subtasks that are executed in sequence. The next subtask is executed only after the current subtask is successfully executed. The request task ends when all subtasks are completed.

The request task is terminated in the following scenarios. You must troubleshoot the issue based on the error code and resubmit the request task:

  • The request task fails to be submitted.

  • A subtask fails to be executed after the request task is submitted.

Status

string

The status of the currently executed subtask. Valid values:

  • operating: The subtask is being executed.

  • success: The subtask is successfully executed.

  • failure: The subtask fails to be executed. For more information about the error details, see the Content parameter.

success

NextTaskId

string

The ID of the subtask to be executed next. If this field is empty, all subtasks have been completed.

abc1

TaskId

string

The ID of the currently executed subtask.

abc

Content

string

The detailed execution status of the current subtask. Details:

  • If the execution is successful, success is displayed.

  • If the execution fails, the corresponding error details are displayed.

success

Examples

Success response

JSON format

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

Error codes

HTTP status code

Error code

Error message

Description

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.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.