AWS Glue Data Catalog 的业务术语表
注意
业务上下文和语义搜索目前为预览 AWS Glue 状态,可能会发生更改。
业务术语表是受控词汇术语的容器,这些术语用于定义组织内部的业务概念。将术语表条目与 Data Catalog 资产进行关联,以赋予其业务语义,并借助语义搜索增强资产的可发现性。
创建术语表
使用 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" }
创建术语表条目
使用 CreateGlossaryTerm 向术语表中添加条目。
aws glue create-glossary-term \ --glossary-identifierglossary-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" }
将术语表条目与资产相关联
使用 AssociateGlossaryTerms 将条目与 Data Catalog 资产相关联。
注意
在预览期间,每个资产最多可以关联 10 个术语表条目。
aws glue associate-glossary-terms \ --asset-identifierasset-id\ --glossary-term-identifiers '["term-id-1", "term-id-2"]'
输出示例:
{ "AssetIdentifier": "asset-id", "GlossaryTerms": ["term-id-1", "term-id-2"] }
删除术语表条目关联
使用 DisassociateGlossaryTerms 从资产中删除条目关联。
aws glue disassociate-glossary-terms \ --asset-identifierasset-id\ --glossary-term-identifiers '["term-id"]'
将术语表术语与单列相关联
您可以将术语表术语关联的范围限定为可迭代表单的单个项目(例如,表中的某一列),而不是整个资产。为此,请将 --iterable-form-name 和 --item-identifier 与资产标识符一起传递。每列是 columns 可迭代表单中的单个项,列名即为该项的标识符。
注意
您最多可以为每列关联 5 个术语表术语。
aws glue associate-glossary-terms \ --asset-identifierasset-id\ --iterable-form-name columns \ --item-identifiercolumn-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-identifierasset-id\ --iterable-form-name columns \ --item-identifiercolumn-name\ --glossary-term-identifiers '["term-id"]'
更新术语表和条目
更新立即生效并反映在搜索结果中。
更新术语表
使用 UpdateGlossary:
aws glue update-glossary \ --identifierglossary-id\ --name "Enterprise Finance Glossary" \ --description "Updated standardized financial terms for enterprise reporting"
更新术语表条目
使用 UpdateGlossaryTerm:
aws glue update-glossary-term \ --identifierterm-id\ --name "Monthly Active User" \ --short-description "A user with at least one login in the last 30 days"
删除术语表和条目
您必须先删除术语表中的所有现有条目,然后才能删除术语表。
删除术语表条目
使用 DeleteGlossaryTerm:
aws glue delete-glossary-term \ --identifierterm-id
删除术语表
删除所有术语后使用 DeleteGlossary:
aws glue delete-glossary \ --identifierglossary-id
列出术语表和条目
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-identifierglossary-id\ --max-results 10
输出示例:
{ "GlossaryId": "gl-c9vq7sh2fk4t2h", "Items": [ {"Id": "gt-d7xm3np5rk2w9j", "Name": "Active User"}, {"Id": "gt-j6rm4xv9np8w3t", "Name": "EBITDA"} ] }
检索术语表和条目详情
检索术语表
运行以下命令:
aws glue get-glossary \ --identifierglossary-id
检索术语表条目
运行以下命令:
aws glue get-glossary-term \ --identifierterm-id