EX-8: Programmatic Column Tagging in Unity Catalog
Track: Metadata & Glossaries • Difficulty: Intermediate • Mastery Points: 150 PTS
Business Problem Scenario
Unity Catalog enables active metadata tags to be attached directly to tables and columns. These machine-readable tags are dynamically consumed by data masking policies, quality firewalls, and audit scrapers. To protect the core banking ledger and enforce regulatory monitoring, you must programmatically tag silver.core_balances.ledger_balance with its official CDE identification, regulatory flag, and data security tier.
Engineering Objective
Write the ALTER TABLE silver.core_balances ALTER COLUMN ledger_balance SET TAGS (...) DDL command. • Target Column: silver.core_balances.ledger_balance • Tag Specifications: Set cde.flag = 'true', cde.id = 'CDE-007', and cde.tier = 'Restricted'. • Enforcement Note: Tags serve as declarative metadata; security firewalls, dynamic masking policies, and audit linters consume these tags to enforce governance and column protection policies. Key Concepts: - Unity Catalog Column Tagging: Declarative key-value metadata attached directly to catalog column definitions, powering automated compliance and security policies.
Target Table: silver.core_balances (account_id STRING, balance_date DATE, ledger_balance DECIMAL(18,2))
Verification & Architecture Insights
Active tags are machine-readable; automated security engines inspect `cde.tier = 'Restricted'` to dynamically apply masking functions at runtime.