2025-03-21 16:00:05 -07:00
|
|
|
from datahub.sdk import DataHubClient, DatasetUrn, GlossaryTermUrn
|
2022-02-18 09:45:45 -08:00
|
|
|
|
2025-03-21 16:00:05 -07:00
|
|
|
client = DataHubClient.from_env()
|
2022-02-18 09:45:45 -08:00
|
|
|
|
2025-03-21 16:00:05 -07:00
|
|
|
dataset = client.entities.get(
|
|
|
|
DatasetUrn(platform="hive", name="realestate_db.sales", env="PROD")
|
2022-02-18 09:45:45 -08:00
|
|
|
)
|
2025-03-21 16:00:05 -07:00
|
|
|
dataset.add_term(GlossaryTermUrn("Classification.HighlyConfidential"))
|
2022-02-18 09:45:45 -08:00
|
|
|
|
2025-08-21 10:22:08 -07:00
|
|
|
# Or, if you know the term name but not the term urn:
|
|
|
|
term_urn = client.resolve.term(name="PII")
|
|
|
|
dataset.add_term(term_urn)
|
|
|
|
|
2025-03-21 16:00:05 -07:00
|
|
|
client.entities.update(dataset)
|