メタデータエンティティをバッチで作成します。バッチ内のすべてのエンティティは同じエンティティタイプである必要があります。この操作は現在、カスタムタイプと拡張テーブルタイプ(データベースとテーブルを表す)のみをサポートしています。
操作説明
You must purchase DataWorks Professional Edition or a higher edition to use this operation.
今すぐお試しください
テスト
RAM 認証
リクエスト構文
POST HTTP/1.1
リクエストパラメーター
|
パラメーター |
型 |
必須 / 任意 |
説明 |
例 |
| Entities |
array<object> |
必須 |
エンティティリスト。バッチで最大 5 つのエンティティを作成できます。バッチ内のすべてのエンティティは同じ |
[] |
|
array<object> |
任意 |
An object that represents a metadata entity. |
||
| EntityType |
string |
必須 |
The entity type. All entities in a batch must have the same type. The following types are supported:
|
custom_entity-customer_api |
| Name |
string |
必須 |
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 |
任意 |
The comment for the entity. |
this is a comment |
| Attributes |
object |
任意 |
The entity attributes. Complex values must be serialized into a JSON string. |
|
|
string |
任意 |
An entity attribute. |
key1 |
|
| CustomAttributes |
object |
任意 |
The custom attribute values. The key is the identifier of the custom attribute, and the value is a single-element list. 重要 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 |
任意 |
A list of custom attribute values. |
||
|
string |
任意 |
A custom attribute value. |
value1 |
拡張データベース
EntityType を custom_xxx-database に設定します。xxx プレースホルダーは、custom_xxx-table などのテーブルの既存の拡張エンティティ定義(EntityDef)から導出されます。
属性
| 属性キー | 必須 | タイプ | 説明 |
parentMetaEntityId | はい | String | 親インスタンス ID。インスタンスレベルである必要があり、カタログ、データベース、スキーマ、テーブル、またはカラムの識別子を含めることはできません。 |
technicalMetadata.location | いいえ | String | データベースのストレージロケーション。 |
拡張テーブル
EntityType を custom_xxx-table に設定します。Attributes.columns パラメーターを使用してテーブルカラムも登録する必要があります。
属性
| 属性キー | 必須 | タイプ | 説明 |
parentMetaEntityId | はい | String | 親データベース ID。データベースレベルである必要があります。 |
tableType | いいえ | String | テーブルタイプ。このパラメーターを設定しない場合、デフォルト値 TABLE が使用されます。 |
partitionKeys | いいえ | JSON 配列文字列 | パーティションキー。例: ["dt"]。 |
technicalMetadata.location | いいえ | String | ストレージロケーション。 |
technicalMetadata.compressed | いいえ | Boolean string or JSON boolean | データが圧縮されているかどうかを指定します。 |
technicalMetadata.inputFormat | いいえ | String | 入力フォーマット。 |
technicalMetadata.outputFormat | いいえ | String | 出力フォーマット。 |
technicalMetadata.serializationLibrary | いいえ | String | シリアライゼーション/デシリアライゼーション(SerDe)ライブラリ。 |
technicalMetadata.parameters | いいえ | JSON オブジェクト文字列 | パラメーター情報。例: {"retention":"30"}。 |
columns | いいえ | JSON 配列文字列 | 埋め込みカラムのリスト。テーブル作成時に拡張カラムを登録するには、このパラメーターを使用します。 |
Attributes.columns
columns パラメーターは Attributes 内の JSON 配列文字列です。配列内の各オブジェクトは以下のフィールドをサポートしています:
| パラメーター | 必須 | タイプ | 説明 |
name | はい | String | カラム名。このプロパティが空の場合、カラムはスキップされます。 |
type | はい | String | カラムタイプ。このプロパティが欠落している場合、システムは attributes.columns[i].type のエラーを報告します。 |
comment | いいえ | String | カラムのコメント。 |
position | いいえ | Integer | カラムの位置。指定しない場合、デフォルトで配列インデックス i + 1 になります。 |
partitionKey | いいえ | Boolean | カラムがパーティションキーかどうかを指定します。 |
primaryKey | いいえ | Boolean | カラムがプライマリキーかどうかを指定します。 |
customAttributes | いいえ | Object | カラムのカスタム属性値。 |
例.
拡張データベースの作成
{
"Entities": [
{
"EntityType": "custom_demo-database",
"Name": "ods",
"Comment": "ODS データベース",
"Attributes": {
"parentMetaEntityId": "custom_demo:demo_source",
"technicalMetadata.location": "oss://bucket/ods"
},
"CustomAttributes": {
"biz_owner": ["data_team"]
}
}
]
}
```.
### 拡張テーブルとカラムの作成
```json
{
"Entities": [
{
"EntityType": "custom_demo-table",
"Name": "order_fact",
"Comment": "注文ファクトテーブル",
"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\":\"プライマリキー\",\"position\":1,\"primaryKey\":true,\"customAttributes\":{\"security_level\":[\"P1\"]}},{\"name\":\"dt\",\"type\":\"STRING\",\"comment\":\"パーティション日付\",\"position\":2,\"partitionKey\":true}]"
},
"CustomAttributes": {
"biz_owner": ["data_team"]
}
}
]
}
```.
## 使用上の注意
- 拡張データベースの `parentMetaEntityId` は、`custom_demo:demo_source` のようにインスタンスレベルである必要があります。
- 拡張テーブルの `parentMetaEntityId` は、`custom_demo-database:demo_source::ods` のようにデータベースレベルである必要があります。
- 親エンティティと子エンティティは同じ拡張ファミリーに属する必要があります。例えば、`custom_demo-table` エンティティの親は `custom_demo-database` エンティティである必要があります。
- `columns` パラメーターはテーブル作成時にのみ指定できます。`BatchCreateMetaEntities` 操作を使用して `custom_xxx-column` エンティティを個別に作成することはできません。
- 拡張エンティティの場合、書き込みパスは `MetaEntityDef.AttributeDefs` に基づいて `Attributes` パラメーター内の不明なキーを厳密にブロックしません。不明なキーは通常無視されます。
レスポンスフィールド
|
フィールド |
型 |
説明 |
例 |
|
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 |
| 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. |
例
成功レスポンス
JSONJSON
{
"RequestId": "9E0C8E7A-C6BE-5A73-9562-2A030A80E8C6",
"Success": true,
"Results": [
{
"Name": "entity_01",
"EntityType": "custom_entity-demo",
"Id": "custom_entity-demo:entity_01",
"Success": true,
"ErrorMessage": "The specified parameters are invalid."
}
]
}
エラーコード
完全なリストについては、「エラーコード」をご参照ください。
変更履歴
完全なリストについては、「変更履歴」をご参照ください。