Lab 15: Data Governance & Compliance
Step 1: Data Classification Framework
┌─────────────────────────────────────────────────────────────┐
│ DATA CLASSIFICATION TIERS │
├─────────────────────────────────────────────────────────────┤
│ TIER 1 - PUBLIC │ Marketing content, public docs │
│ TIER 2 - INTERNAL │ Business data, non-sensitive records │
│ TIER 3 - CONFIDENTIAL│ Financial data, employee records │
│ TIER 4 - RESTRICTED │ PII, PHI, payment card data (PCI) │
└─────────────────────────────────────────────────────────────┘-- Tag columns with classification metadata
COMMENT ON COLUMN users.email IS 'PII:TIER4:GDPR:encrypted';
COMMENT ON COLUMN users.full_name IS 'PII:TIER4:GDPR:pseudonymizable';
COMMENT ON COLUMN users.birth_date IS 'PII:TIER4:GDPR:encrypted';
COMMENT ON COLUMN users.ssn IS 'PII:TIER4:HIPAA:encrypted:tokenized';
COMMENT ON COLUMN users.created_at IS 'OPERATIONAL:TIER2';
COMMENT ON COLUMN users.country_code IS 'OPERATIONAL:TIER2';
-- Query all PII columns across the database
SELECT
table_name,
column_name,
obj_description(
(table_schema || '.' || table_name)::regclass, 'pg_class'
) AS table_comment,
col_description(
(table_schema || '.' || table_name)::regclass,
ordinal_position
) AS classification
FROM information_schema.columns
WHERE table_schema = 'public'
AND col_description(
(table_schema || '.' || table_name)::regclass,
ordinal_position
) LIKE '%PII%';Step 2: PII Column Detection & Schema Design
Step 3: Row-Level Security (RLS) for GDPR
Step 4: Audit Logging
Step 5: GDPR Right to Erasure
Step 6: Data Retention Policies
Step 7: Encryption Requirements & Data Masking
Step 8: Capstone — Compliance Automation Framework
Summary
Concept
Implementation
Regulation
Last updated
