This repository contains Databricks notebooks demonstrating data privacy and security features available in Unity Catalog.
The notebooks/data-privacy/ directory contains comprehensive demonstrations of:
- Role-Based Access Control (RBAC) - Grant permissions based on user roles
- Views - Dynamic, Restricted, and Materialized views for controlled data access
- Data Hashing - Irreversible masking using hash functions
- Data Masking - Format-preserving obfuscation of sensitive data
- Row-Level Filtering - Scope data access by user attributes or regions
- Data Tokenization - Reversible token replacement for PII
- Attribute-Based Access Control (ABAC) - Policy-driven access using metadata tags
- Data Encryption - Protect data at rest and in transit
notebooks/data-privacy/data_privacy.ipynb- Main demonstration notebooknotebooks/data-privacy/setup_environment.ipynb- Environment setup (called automatically)notebooks/data-privacy/data_encryption.ipynb- Detailed encryption examplesnotebooks/data-privacy/utilities.py- Helper functions for privacy operations
- Databricks workspace with Unity Catalog enabled
- Appropriate permissions to create schemas, tables, and functions
- Python 3.8+ (for local development)
- Import the notebooks into your Databricks workspace
- Attach to a cluster (Serverless recommended for fine-grained access controls)
- Configure your preferences in the Configuration cell:
USE_TEMP_TABLES = True(recommended for demos - auto-cleanup)USE_TEMP_TABLES = False(for persistent environments)
- Run the cells sequentially to see each privacy feature demonstrated
The notebooks automatically create:
- Sample schemas (hr, customers, retail, governance) - only if using permanent tables
- Sample tables with test data (temporary or permanent based on config)
- User-defined functions for masking, filtering, and tokenization
- Views demonstrating various privacy techniques
Key Features:
- Temporary Tables Mode - No manual cleanup required (default)
- Modular Setup - Environment setup in separate notebook, called via
%run - Clean Demo Experience - Setup code hidden from main demonstrations
- Environment Agnostic - Clear placeholders for group names and configurations
Combine multiple privacy techniques for comprehensive data protection.
All privacy controls are managed through Unity Catalog for centralized governance.
All access controls are logged and auditable for regulatory compliance.
For questions or issues, please refer to the Databricks Documentation or contact your Databricks representative.
Copyright © Databricks. All rights reserved.