All Products
Search
Document Center

DataWorks:BatchCreateMetaEntities

Last Updated:Jun 11, 2026

Membuat entitas metadata secara batch. Semua entitas dalam satu batch harus memiliki tipe entitas yang sama. Operasi ini saat ini hanya mendukung tipe kustom dan tipe tabel yang diperluas, yang merepresentasikan database dan tabel.

Deskripsi operasi

You must purchase DataWorks Professional Edition or a higher edition to use this operation.

Coba sekarang

Coba API ini di OpenAPI Explorer tanpa perlu penandatanganan manual. Panggilan yang berhasil akan secara otomatis menghasilkan contoh kode SDK sesuai dengan parameter Anda. Unduh kode tersebut dengan kredensial bawaan yang aman untuk penggunaan lokal.

Test

RAM authorization

Tidak ada otorisasi untuk operasi ini. Jika Anda mengalami masalah saat menjalankan operasi ini, hubungi dukungan teknis.

Sintaks permintaan

POST  HTTP/1.1

Parameter permintaan

Parameter

Type

Required

Description

Example

Entities

array<object>

Yes

Daftar entitas. Anda dapat membuat hingga lima entitas dalam satu batch. Semua entitas dalam batch harus memiliki EntityType yang sama.

[]

array<object>

No

An object that represents a metadata entity.

EntityType

string

Yes

The entity type. All entities in a batch must have the same type. The following types are supported:

  • Custom types, such as custom_entity-biz_api.

  • Extended table types. For example, if you have registered the custom_dw-table metadata entity type, you can create objects of the corresponding custom_dw-database (database) and custom_dw-table (table) types.

custom_entity-customer_api

Name

string

Yes

The entity name. The name can contain uppercase letters, lowercase letters, digits, and underscores (_). It must start with a letter and not exceed 64 characters.

api_001

Comment

string

No

The comment for the entity.

this is a comment

Attributes

object

No

The entity attributes. Complex values must be serialized into a JSON string.

string

No

An entity attribute.

key1

CustomAttributes

object

No

The custom attribute values. The key is the identifier of the custom attribute, and the value is a single-element list.

Penting The custom attributes used here must be created in advance by using the CreateCustomAttribute API. For example, after you create a custom attribute with the ID custom-attribute:owner_name, you can configure the custom attribute by setting this parameter to {'owner_name': ['Bob']}.

array

No

A list of custom attribute values.

string

No

A custom attribute value.

value1

Database yang diperluas

Atur EntityType menjadi custom_xxx-database. Placeholder xxx diturunkan dari definisi entitas yang diperluas (EntityDef) yang sudah ada untuk tabel, seperti custom_xxx-table.

Atribut

Kunci atributWajibTipeDeskripsi
parentMetaEntityIdYaStringID instans induk. Harus berada di tingkat instans dan tidak boleh mengandung pengenal katalog, database, skema, tabel, atau kolom.
technicalMetadata.locationTidakStringLokasi penyimpanan database.

Tabel yang diperluas

Atur EntityType menjadi custom_xxx-table. Anda juga harus mendaftarkan kolom tabel menggunakan parameter Attributes.columns.

Atribut

Kunci atributWajibTipeDeskripsi
parentMetaEntityIdYaStringID database induk. Harus berada di tingkat database.
tableTypeTidakStringTipe tabel. Jika parameter ini tidak diatur, nilai default TABLE akan digunakan.
partitionKeysTidakString array JSONKunci partisi. Contoh: ["dt"].
technicalMetadata.locationTidakStringLokasi penyimpanan.
technicalMetadata.compressedTidakString boolean atau boolean JSONApakah data dikompresi.
technicalMetadata.inputFormatTidakStringFormat input.
technicalMetadata.outputFormatTidakStringFormat output.
technicalMetadata.serializationLibraryTidakStringLibrary serialisasi/deserialisasi (SerDe).
technicalMetadata.parametersTidakString objek JSONInformasi parameter. Contoh: {"retention":"30"}.
columnsTidakString array JSONDaftar kolom tertanam. Gunakan parameter ini untuk mendaftarkan kolom yang diperluas saat tabel dibuat.

Attributes.columns

Parameter columns adalah string array JSON di dalam Attributes. Setiap objek dalam array mendukung bidang berikut:

ParameterWajibTipeDeskripsi
nameYaStringNama kolom. Jika properti ini kosong, kolom akan dilewati.
typeYaStringTipe kolom. Jika properti ini tidak ada, sistem akan melaporkan error untuk attributes.columns[i].type.
commentTidakStringKomentar kolom.
positionTidakIntegerPosisi kolom. Jika tidak ditentukan, defaultnya adalah indeks array i + 1.
partitionKeyTidakBooleanApakah kolom merupakan kunci partisi.
primaryKeyTidakBooleanApakah kolom merupakan kunci primer.
customAttributesTidakObjectNilai atribut kustom untuk kolom.

Contoh.

Membuat database yang diperluas

{
  "Entities": [
    {
      "EntityType": "custom_demo-database",
      "Name": "ods",
      "Comment": "ODS database",
      "Attributes": {
        "parentMetaEntityId": "custom_demo:demo_source",
        "technicalMetadata.location": "oss://bucket/ods"
      },
      "CustomAttributes": {
        "biz_Pemilik": ["data_team"]
      }
    }
  ]
}
```.

### Membuat tabel yang diperluas dan kolom

```json
{
  "Entities": [
    {
      "EntityType": "custom_demo-table",
      "Name": "order_fact",
      "Comment": "Order fact table",
      "Attributes": {
        "parentMetaEntityId": "custom_demo-database:demo_source::ods",
        "tableType": "TABLE",
        "partitionKeys": "[\"dt\"]",
        "technicalMetadata.location": "oss://bucket/ods/order_fact",
        "technicalMetadata.compressed": "true",
        "technicalMetadata.parameters": "{\"retention\":\"30\",\"bizDomain\":\"trade\"}",
        "columns": "[{\"name\":\"id\",\"type\":\"BIGINT\",\"comment\":\"Kunci primer\",\"position\":1,\"primaryKey\":true,\"customAttributes\":{\"security_level\":[\"P1\"]}},{\"name\":\"dt\",\"type\":\"STRING\",\"comment\":\"Partition date\",\"position\":2,\"partitionKey\":true}]"
      },
      "CustomAttributes": {
        "biz_Pemilik": ["data_team"]
      }
    }
  ]
}
```.

## Catatan penggunaan

- `parentMetaEntityId` untuk database yang diperluas harus berada di tingkat instans, seperti `custom_demo:demo_source`.

- `parentMetaEntityId` untuk tabel yang diperluas harus berada di tingkat database, seperti `custom_demo-database:demo_source::ods`.

- Entitas induk dan anak harus berada dalam keluarga ekstensi yang sama. Misalnya, induk dari entitas `custom_demo-table` harus berupa entitas `custom_demo-database`.

- Parameter `columns` hanya dapat diberikan saat Anda membuat tabel. Anda tidak dapat menggunakan operasi `BatchCreateMetaEntities` untuk membuat entitas `custom_xxx-column` secara terpisah.

- Untuk entitas yang diperluas, jalur penulisan tidak secara ketat memblokir kunci yang tidak diketahui dalam parameter `Attributes` berdasarkan `MetaEntityDef.AttributeDefs`. Kunci yang tidak diketahui biasanya akan diabaikan.

Elemen respons

Element

Type

Description

Example

object

The response body.

RequestId

string

The request ID.

9E0C8E7A-C6BE-5A73-9562-2A030A80E8C6

Success

boolean

Indicates whether the request was successful. This parameter returns true even if creating some entities fails. To determine the outcome for each entity, check the Success and ErrorMessage fields in the Results array.

true

Results

array

A list of results for the batch creation operation. This list provides the success status and any error messages for each individual entity in the request.

MetaEntityWriteResult

The result of a single entity creation within the batch.

Contoh

Respons sukses

JSONformat

{
  "RequestId": "9E0C8E7A-C6BE-5A73-9562-2A030A80E8C6",
  "Success": true,
  "Results": [
    {
      "Name": "",
      "EntityType": "",
      "Id": "",
      "Success": false,
      "ErrorMessage": ""
    }
  ]
}

Kode kesalahan

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.