全部產品
Search
文件中心

DataWorks:CreateTable

更新時間:Jul 31, 2026

建立一個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

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.

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情