from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
# PII 컬럼 목록 정의
pii_columns = {
"catalog.schema.customers": {
"이름": "name", "전화번호": "phone", "주민번호": "ssn",
"이메일": "email", "주소": "address"
},
"catalog.schema.orders": {
"배송주소": "address", "연락처": "phone"
}
}
for table, columns in pii_columns.items():
for col, pii_type in columns.items():
w.statement_execution.execute_statement(
warehouse_id="<warehouse_id>",
statement=f"ALTER TABLE {table} ALTER COLUMN {col} SET TAGS ('pii' = 'true', 'pii_type' = '{pii_type}')"
)