

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 的業務詞彙表 AWS Glue Data Catalog
<a name="catalog-business-glossaries"></a>

**注意**  
商業內容和語意搜尋為 預覽版 AWS Glue ，可能會有所變更。

商業詞彙表是用於控制詞彙的容器，可定義組織內的商業概念。將詞彙表術語與 Data Catalog 資產建立關聯，使其具有商業意義，並透過語意搜尋提高可探索性。

## 建立詞彙表
<a name="catalog-business-glossaries-create"></a>

使用 `CreateGlossary`建立商業詞彙表。

```
aws glue create-glossary \
    --name "Finance Data Definitions" \
    --description "Standardized financial terms used across reporting and analytics"
```

輸出範例：

```
{
    "Id": "gl-c9vq7sh2fk4t2h",
    "Name": "Finance Data Definitions"
}
```

## 建立詞彙表詞彙
<a name="catalog-business-glossaries-create-term"></a>

使用 `CreateGlossaryTerm`將詞彙新增至詞彙表。

```
aws glue create-glossary-term \
    --glossary-identifier {{glossary-id}} \
    --name "Active User" \
    --short-description "A user with at least one login in the last 30 days" \
    --long-description "An account that has logged in at least once within the trailing 30-day window. Used as the standard engagement metric across all product teams."
```

輸出範例：

```
{
    "Id": "gt-d7xm3np5rk2w9j",
    "GlossaryId": "gl-c9vq7sh2fk4t2h",
    "Name": "Active User"
}
```

## 將詞彙表術語與資產建立關聯
<a name="catalog-business-glossaries-associate"></a>

使用 `AssociateGlossaryTerms`將術語與 Data Catalog 資產建立關聯。

**注意**  
在預覽期間，每個資產最多可以關聯 10 個詞彙表詞彙。

```
aws glue associate-glossary-terms \
    --asset-identifier {{asset-id}} \
    --glossary-term-identifiers '["{{term-id-1}}", "{{term-id-2}}"]'
```

輸出範例：

```
{
    "AssetIdentifier": "{{asset-id}}",
    "GlossaryTerms": ["{{term-id-1}}", "{{term-id-2}}"]
}
```

## 移除詞彙表詞彙關聯
<a name="catalog-business-glossaries-disassociate"></a>

使用 從資產`DisassociateGlossaryTerms`中移除詞彙關聯。

```
aws glue disassociate-glossary-terms \
    --asset-identifier {{asset-id}} \
    --glossary-term-identifiers '["{{term-id}}"]'
```

## 將詞彙表詞彙與單一資料欄建立關聯
<a name="catalog-business-glossaries-associate-item"></a>

您可以將詞彙表詞彙關聯範圍限定為可重複格式的單一項目，例如資料表的一個資料欄，而非整個資產。若要這樣做，請將 `--iterable-form-name`和 與資產識別符`--item-identifier`一起傳遞。每個資料欄都是可`columns`重複格式的單一項目，而資料欄名稱是項目識別符。

**注意**  
每欄最多可以關聯 5 個詞彙表詞彙。

```
aws glue associate-glossary-terms \
    --asset-identifier {{asset-id}} \
    --iterable-form-name columns \
    --item-identifier {{column-name}} \
    --glossary-term-identifiers '["{{term-id}}"]'
```

回應會回應可重複的表單名稱和項目識別符，以及資料欄的目前詞彙清單：

```
{
    "AssetIdentifier": "{{asset-id}}",
    "IterableFormName": "columns",
    "ItemIdentifier": "{{column-name}}",
    "GlossaryTerms": ["{{term-id}}"]
}
```

若要從資料欄移除字詞，請使用具有相同 `--iterable-form-name`和 `--item-identifier` 參數的 `disassociate-glossary-terms`命令。與資產層級相關聯的術語和與個別資料欄相關聯的術語是獨立的。

```
aws glue disassociate-glossary-terms \
    --asset-identifier {{asset-id}} \
    --iterable-form-name columns \
    --item-identifier {{column-name}} \
    --glossary-term-identifiers '["{{term-id}}"]'
```

## 更新詞彙表和術語
<a name="catalog-business-glossaries-update"></a>

更新會立即生效，並反映在搜尋結果中。

**更新詞彙表**  
使用 `UpdateGlossary`：

```
aws glue update-glossary \
    --identifier {{glossary-id}} \
    --name "Enterprise Finance Glossary" \
    --description "Updated standardized financial terms for enterprise reporting"
```

**更新詞彙表字詞**  
使用 `UpdateGlossaryTerm`：

```
aws glue update-glossary-term \
    --identifier {{term-id}} \
    --name "Monthly Active User" \
    --short-description "A user with at least one login in the last 30 days"
```

## 刪除詞彙表和術語
<a name="catalog-business-glossaries-delete"></a>

您必須從詞彙表刪除所有詞彙，才能刪除詞彙表。

**刪除詞彙表字詞**  
使用 `DeleteGlossaryTerm`：

```
aws glue delete-glossary-term \
    --identifier {{term-id}}
```

**刪除詞彙表**  
在移除所有術語`DeleteGlossary`後使用 ：

```
aws glue delete-glossary \
    --identifier {{glossary-id}}
```

## 列出詞彙表和術語
<a name="catalog-business-glossaries-list"></a>

`ListGlossaries` 和 都`ListGlossaryTerms`支援使用 `MaxResults`和 進行分頁`NextToken`。

**列出所有詞彙表**  
執行以下命令：

```
aws glue list-glossaries \
    --max-results 10
```

輸出範例：

```
{
    "Items": [
        {"Id": "gl-c9vq7sh2fk4t2h", "Name": "Finance Data Definitions"},
        {"Id": "gl-f8yn2bx7jl5r4k", "Name": "Marketing Glossary"}
    ]
}
```

**在詞彙表中列出詞彙**  
執行以下命令：

```
aws glue list-glossary-terms \
    --glossary-identifier {{glossary-id}} \
    --max-results 10
```

輸出範例：

```
{
    "GlossaryId": "gl-c9vq7sh2fk4t2h",
    "Items": [
        {"Id": "gt-d7xm3np5rk2w9j", "Name": "Active User"},
        {"Id": "gt-j6rm4xv9np8w3t", "Name": "EBITDA"}
    ]
}
```

## 擷取詞彙表和術語詳細資訊
<a name="catalog-business-glossaries-get"></a>

**擷取詞彙表**  
執行以下命令：

```
aws glue get-glossary \
    --identifier {{glossary-id}}
```

**擷取詞彙表字詞**  
執行以下命令：

```
aws glue get-glossary-term \
    --identifier {{term-id}}
```