Annotated Schema API を使用して、データ分類用のタグでカラムに注釈を付けることができます。ビジネスニーズに応じてカスタムタグを作成できます。例えば、機密データ、個人識別情報(PII)、財務データなどのタグを作成できます。Annotated Schema API を使用すると、既存のカスタムタグの一覧表示、カラムへのタグ付け、特定のタグを含むカラムの検索などが可能です。
API エンドポイントは https://api-data-def-repo.treasuredata.com/ です。
以下のリクエストとレスポンスの例で、sensitive フィールドはカラムのタグ付けの UI でサポートされなくなりました。sensitive フィールドは下位互換性をサポートするために API にのみ残されています。
Column Annotationには上限があります。詳細は Treasure Data の上限一覧(MAX) を参照してください。
テーブルに制限するオプション付きでColumn Annotationの一覧をリクエストします。
| メソッド | リソース | 説明 |
|---|---|---|
| GET | /v1/column-annotation | テーブルに制限するオプション付きでColumn Annotationの一覧を取得します |
| パラメータ名 | 必須 | 型 | 説明 |
|---|---|---|---|
tableID | いいえ | String | データベース名とテーブル名 形式: DatabaseId.TableId例: 1234563311.123455121 |
keyset | いいえ | String | 次のページの一意の ID 例: `2020-07-13T16:49:08.171013Z |
API Key と使用するデータベース ID およびテーブル ID を使用してください。
TableID でフィルタリング
curl -s -H "Authorization: TD1 $TD_AWS_API" 'https://api-data-def-repo.treasuredata.com/v1/column-annotation?filter%5BtableId%5D=56789589.567890314'Keyset でフィルタリング
curl -s -H "Authorization: TD1 $TD_AWS_API" 'https://api-data-def-repo.treasuredata.com/v1/column-annotation?filter%5Bkeyset%5D=2020-07-13T16:49:08.171013Z|ffbc617e-1235-4567-8901-033c75dc6601'ステータス: 200 Success
{
"data": [
{
"type": "column-annotation",
"id": "00000000-0000-0000-0000-000000000000",
"attributes": {
"comment": "string",
"createdAt": "2020-07-09T19:08:01Z",
"sensitive": true
},
"relationships": {
"annotation-type": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "annotation-type"
}
},
"table": {
"data": {
"id": "1234.5678",
"type": "treasure-data-table"
}
},
"column": {
"data": {
"id": "column",
"type": "treasure-data-column"
}
},
"created-by": {
"data": {
"id": "user",
"type": "treasure-data-user"
}
}
}
}
],
"links": {
"first": "/v1/foo",
"self": "/v1/foo",
"next": "/v1/foo?page%5Bkeyset%5D=abc123"
},
"meta": {
"perPage": 250
}
}一括で注釈を作成します。
| メソッド | リソース | 説明 |
|---|---|---|
| POST | /v1/column-annotation/bulk | 一括で注釈を作成します。 |
| 必須 | 型 | 説明 |
|---|---|---|
tableID | はい | String |
| プロパティ名 | 値 | 説明 |
|---|---|---|
| type | string | treasure-data-column |
| attributes | object | パラメータ: attributes.comment: 注釈とテーブル間の関係の説明 attributes.sensitive: true の場合、カラムに機密データが含まれていることを示します |
relationship| object| パラメータ: リレーションシップ名 relationships.annotation-type: カラムにアタッチする注釈 relationships.column: 注釈を付けるカラム
database.table "496329.2811294" の2つのカラム("c1" と "c2")にタグ "PII"(tag_id = "62290bc0-9027-461f-81d6-75c146311299")で注釈を付ける
{
"data": [
{
"type": "column-annotation",
"attributes": {
"sensitive": false
},
"relationships": {
"annotation-type": {
"data": {
"id": "62290bc0-9027-461f-81d6-75c146311234",
"type": "annotation-type"
}
},
"column": {
"data": {
"id": "c1",
"type": "treasure-data-column"
}
}
}
},
{
"type": "column-annotation",
"attributes": {
"sensitive": false
},
"relationships": {
"annotation-type": {
"data": {
"id": "62290bc0-9027-461f-81d6-75c146311234",
"type": "annotation-type"
}
},
"column": {
"data": {
"id": "c2",
"type": "treasure-data-column"
}
}
}
}
]
}ステータス: 201 Success
{
"data": [
{
"id": "361b73d4-f82c-4ea3-9230-34966436faf4",
"attributes": {
"comment": null,
"createdAt": "2022-02-01T23:00:36.379169Z",
"sensitive": false
},
"relationships": {
"annotation-type": {
"data": {
"type": "annotation-type",
"id": "62290bc0-9027-461f-81d6-75c146311234",
"name": "PII"
}
},
"table": {
"data": {
"type": "treasure-data-table",
"id": "496789.2811294"
}
},
"column": {
"data": {
"type": "treasure-data-column",
"id": "c1"
}
},
"created-by": {
"data": {
"type": "treasure-data-user",
"id": "27770"
}
}
},
"type": "column-annotation"
},
{
"id": "abd0cbf4-d66d-4fc9-a8e8-8fe45897f741",
"attributes": {
"comment": null,
"createdAt": "2022-02-01T23:00:36.379169Z",
"sensitive": false
},
"relationships": {
"annotation-type": {
"data": {
"type": "annotation-type",
"id": "62290bc0-9027-461f-81d6-75c146311234",
"name": "PII"
}
},
"table": {
"data": {
"type": "treasure-data-table",
"id": "496789.2811294"
}
},
"column": {
"data": {
"type": "treasure-data-column",
"id": "c2"
}
},
"created-by": {
"data": {
"type": "treasure-data-user",
"id": "27770"
}
}
},
"type": "column-annotation"
}
],
"links": {
"first": "/v1/column-annotation?filter%5BtableId%5D=496789.2811294",
"self": "/v1/column-annotation?filter%5BtableId%5D=496789.2811294"
},
"meta": {
"perPage": 2
}
}特定のColumn Annotationを含むカラムの一覧をリクエストします。
| メソッド | リソース | 説明 |
|---|---|---|
| GET | /v1/column-annotation/lookup | 特定の注釈タイプの一覧を取得します。 |
| 必須 | 型 | 説明 |
|---|---|---|
annotationTypeName | はい | String |
サンプルレスポンス
ステータス: 200 Success
{
"data": [
{
"type": "column-annotation",
"id": "c822f1ee-95b9-440e-ac2c-3efd4c6211b7",
"attributes": {
"comment": "",
"createdAt": "2021-04-19T22:06:06.585109Z",
"sensitive": false
},
"relationships": {
"annotation-type": {
"data": {
"type": "annotation-type",
"id": "ecd4fa1e-a11f-11ea-b759-acde48001122",
"name": "home-address"
}
},
"table": {
"data": {
"type": "treasure-data-table",
"id": "484834.2781752"
}
},
"column": {
"data": {
"type": "treasure-data-column",
"id": "host"
}
},
"created-by": {
"data": {
"type": "treasure-data-user",
"id": "18174"
}
}
}
}
],
"links": {
"first": "/v1/column-annotation/lookup?annotationTypeName=home-address",
"self": "/v1/column-annotation/lookup?annotationTypeName=home-address"
},
"meta": {
"perPage": 250
}
}デフォルトの注釈タイプの一覧をリクエストします。
| メソッド | リソース | 説明 |
|---|---|---|
| GET | v1/annotation-type/defaults | すべてのアカウントにデフォルトで提供される注釈タイプの一覧を取得します。 |
ステータス: 200 Success
{
"data": [
{
"attributes": {
"comment": "Identifies an email box to which messages can be delivered",
"createdAt": "2019-08-24T14:15:22Z",
"humanReadableName": "Email Address",
"name": "email",
"namespace": "Identity",
"updatedAt": "2019-08-24T14:15:22Z",
"version": 1
},
"id": "00000000-0000-0000-0000-000000000000",
"type": "annotation-type"
}
],
"links": {
"first": "/v1/foo",
"next": "/v1/foo?page[keyset]=abc123",
"self": "/v1/foo"
},
"meta": {
"perPage": 0
}
}カスタム注釈タイプの一覧をリクエストします。
| メソッド | リソース | 説明 |
|---|---|---|
| GET | /v1/annotation-type/custom | カスタム注釈タイプの一覧を取得します。 |
ステータス: 200 Success
カスタマイズされた注釈タイプを作成します。Administratorのみがこの API を呼び出すことができます。
| メソッド | リソース | 説明 |
|---|---|---|
| POST | /v1/annotation-type/custom | カスタム注釈タイプを作成します。 |
リクエストボディ
| プロパティ名 | 値 | 説明 |
|---|---|---|
| attributes | object | パラメータ: • attributes.comment: 注釈タイプの説明。• attributes.humanReadableName: UI に表示される表示名。• attributes.name: Permission Policy API で使用される注釈名。• attributes.namespace: タグタイプを指定する名前空間(例: POLICY または RESOURCE)。• attributes.color: UI で使用されるタグの色。許容される値:• POLICY_DEFAULT• RESOURCE_DEFAULT• NON_PII• PII• SECONDARY• SECONDARY_2 |
UI での色のマッピングについては、タグの作成のドキュメントを確認してください。
サンプルレスポンス
UUID を使用して注釈タイプを削除します。Administratorのみがこの API を呼び出すことができます。
| メソッド | リソース | 説明 |
|---|---|---|
| DELETE | /v1/annotation-type/custom/UUID | UUID を使用してカスタム注釈タイプを削除します。 |