Complete solution for migrating Databricks Unity Catalog workspaces from one environment to another
This toolkit provides TWO migration approaches:
-
π Python Scripts (Root directory) - Fast, imperative, script-based migration
- β Best for: One-time migrations, quick setup
- β Easier to learn and customize
-
ποΈ Terraform (
/terraformdirectory) - Declarative Infrastructure as Code- β Best for: Ongoing management, multi-environment
- β State management and drift detection
Not sure which to use? See PYTHON_VS_TERRAFORM.md for detailed comparison.
Migrate all workspace objects between Databricks Unity Catalog workspaces:
- β Users & Groups
- β Notebooks (all languages)
- β Jobs & Workflows (600+ supported)
- β Clusters & Policies
- β SQL Warehouses
- β Secret Scopes
- β Git Repository Integrations
- β Workspace Folder Structure
pip install -r requirements.txt# Copy example config
cp config.example.json config.json
# Edit with your workspace details
nano config.jsonRequired configuration:
{
"source": {
"host": "https://your-source-workspace.cloud.databricks.com",
"token": "dapi_your_source_token"
},
"target": {
"host": "https://your-target-workspace.cloud.databricks.com",
"token": "dapi_your_target_token"
}
}python validate_migration.py# Option A: Run all migrations
python run_all_migrations.py
# Option B: Run individually
python migrate_users_groups.py
python migrate_notebooks.py
# ... etc| Document | Purpose |
|---|---|
| INDEX.md | π Documentation navigator |
| SUMMARY.md | π Overview & architecture |
| QUICK_REFERENCE.md | β‘ Command cheat sheet |
| MIGRATION_GUIDE.md | π Complete detailed guide |
| MIGRATION_CHECKLIST.md | βοΈ Step-by-step checklist |
| SCRIPTS_REFERENCE.md | π§ Technical script docs |
| ARCHITECTURE.md | ποΈ Visual diagrams |
New to migration? Start with SUMMARY.md β MIGRATION_GUIDE.md
Quick commands needed? Check QUICK_REFERENCE.md
Complete navigation? See INDEX.md
Phase 1: Foundation Phase 2: Content Phase 3: Orchestration
βββββββββββββββββββββ βββββββββββββββββ ββββββββββββββββββββββ
1. Users & Groups β 6. Clusters β 9. Jobs/Workflows
2. Cluster Policies β 7. Notebooks β (depends on all)
3. SQL Warehouses β 8. Git Repos β
4. Secret Scopes β
5. Workspace Folders β
Total Time: ~6-7 hours for typical workspace (adjust based on object count)
migrate_users_groups.py- Users and AD groupsmigrate_cluster_policies.py- Governance policiesmigrate_sql_warehouses.py- SQL compute resourcesmigrate_secret_scopes.py- Secret managementmigrate_workspace_folders.py- Directory structuremigrate_clusters.py- All-purpose clustersmigrate_notebooks.py- Jupyter notebooksmigrate_git_repos.py- Git integrationsmigrate_jobs.py- Workflows and schedules
validate_migration.py- Pre-flight checksrun_all_migrations.py- Orchestrate all migrationsutils.py- Shared helper functions
config.json- Your workspace settingsconfig.example.json- Configuration templaterequirements.txt- Python dependencies
After migration completes, you MUST:
-
Update Secret Values π΄ REQUIRED
- Placeholders created, need real values
- Cannot be read from source (API limitation)
-
Re-authenticate Git Repos π΄ REQUIRED
- Credentials don't migrate (security)
- Re-enter personal access tokens
-
Update Job Cluster IDs π΄ REQUIRED
- Cluster IDs change during migration
- Update references in all jobs
-
Test Workflows π‘ RECOMMENDED
- Run sample jobs to verify
- Check notebook execution
See MIGRATION_GUIDE.md for details.
- β
Automatic backups before migration (
backup_*.jsonfiles) - β Pre-migration validation tool
- β Detailed logging with error tracking
- β Continue on error option (optional)
- β Dry-run mode available
Handles enterprise workspaces:
- 600+ jobs per business team
- 100+ notebooks
- Multiple clusters and warehouses
- Complex folder hierarchies
- Large user/group structures
- API tokens never logged
- Secret values handled securely (placeholders only)
- Git credentials require re-authentication
- Follows Databricks best practices
- Backup files can be encrypted
| Issue | Solution |
|---|---|
| Connection fails | Run python validate_migration.py |
| Permission denied | Verify API token has admin permissions |
| Object already exists | Delete from target or enable overwrite |
| Job fails after migration | Update cluster IDs in job settings |
Full troubleshooting guide: MIGRATION_GUIDE.md
Access Requirements:
- Admin or appropriate permissions in both workspaces
- API tokens for both source and target workspaces
- Network access to both Databricks workspaces
Software Requirements:
- Python 3.8 or higher
- pip package manager
- Git (optional, for version control)
Permissions Needed:
- Workspace access
- Cluster management
- Job management
- Secret scope access
- User/group management (SCIM API)
- Repos management
- OS: macOS, Linux, or Windows with Python
- Memory: 1GB+ recommended
- Disk: 500MB+ free space (for backups)
- Network: Stable internet connection
# Validate setup
python validate_migration.py
# Run all migrations
python run_all_migrations.py
# Review logs and backups
ls backup_*.json# Migrate only notebooks
python migrate_notebooks.py
# Migrate only jobs
python migrate_jobs.pyAll scripts provide progress output:
2026-01-08 10:30:00 - migrate_notebooks - INFO - Starting notebook migration...
2026-01-08 10:30:05 - migrate_notebooks - INFO - Found 123 notebooks
2026-01-08 10:30:10 - migrate_notebooks - INFO - Exporting notebook: /Users/john/analysis.py
...
2026-01-08 10:35:00 - migrate_notebooks - INFO - Migration completed
2026-01-08 10:35:00 - migrate_notebooks - INFO - Success: 123
2026-01-08 10:35:00 - migrate_notebooks - INFO - Failed: 0
- Check documentation (see INDEX.md)
- Review troubleshooting guide (MIGRATION_GUIDE.md)
- Examine backup files created during migration
- Check detailed logs in console output
This toolkit is designed for Databricks Unity Catalog workspace migrations.
- Full Migration Guide - Comprehensive instructions
- Command Reference - Quick command lookups
- Migration Checklist - Track your progress
- Architecture Diagrams - Visual workflow
- Script Details - Technical documentation
Your migration is successful when:
- β All 9 migration scripts complete without errors
- β Users can log into target workspace
- β Notebooks open and run correctly
- β Test jobs execute successfully
- β SQL warehouses process queries
- β Git repos can pull/push
- β Secrets are working in notebooks/jobs
- Always test in non-production first!
- Secret values must be re-entered manually (API security limitation)
- Git credentials must be re-authenticated (security)
- Job cluster IDs need updating after migration (IDs change)
- Review MIGRATION_GUIDE.md for limitations
# 1. Review the summary
cat SUMMARY.md
# 2. Install dependencies
pip install -r requirements.txt
# 3. Configure workspaces
cp config.example.json config.json
nano config.json
# 4. Validate setup
python validate_migration.py
# 5. Start migration
python run_all_migrations.py
# 6. Follow checklist
cat MIGRATION_CHECKLIST.mdQuestions? See INDEX.md for complete documentation navigation.
Need help? Check MIGRATION_GUIDE.md troubleshooting section.
Want quick commands? See QUICK_REFERENCE.md.
Happy Migrating! π