DEV Community

Danny C.
Danny C.

Posted on

Unity Catalog Migration Deep Dive

Unity Catalog Migration Deep Dive

Specialist Session | Kiran Sreekumar & Sam Le Corre

Session Overview

  • Topics covered in migrating from Hive Metastore to Unity Catalog: Approaches, Planning, Tools, Common challenges.

Governance Architecture & Key Changes

A unified governance experience is a step-change in approach compared to HMS.

  • Without Unity Catalog — Workspace 1 manages: User Management, Metastore, Access Controls, Clusters / SQL Warehouses.

  • Without Unity Catalog — Workspace 2 manages: User Management, Metastore, Access Controls, Clusters / SQL Warehouses.

  • With Unity Catalog — Unity Catalog centralizes: User Management, Metastore, Foreign Databases, Access Controls.

  • With Unity Catalog — Individual Workspaces manage: Clusters / SQL Warehouses.

  • Things you should know about what changes: Identity Federation, Metastores, DBFS, Three Level Namespace, Hive Metastore / Default Catalog, Cluster / Compute Type Requirements & Limitations, Storage Access.

Migration Approaches

Different techniques for migrating.

  • Why approaches before planning? The approach you take significantly impacts 'how' you go about migration, so it helps to think about first.

  • What influences this decision? Scale (Number of users, workspaces, assets), Time and resource availability, Single-phase vs multi-phase vs incrementally move, Modernise vs migrate.

  • Common pattern — Parallel environments: Legacy workspace with hive metastore provides read only access via Lakehouse Federation to a new UC enabled workspace.

  • Common pattern — 1:1 HMS to Catalog: Existing workspace(s) upgrade HMS to a Workspace catalog within Organisations Unity Catalog.

  • Common pattern — Full migration: Existing workspace(s) upgrade HMS and map to full UC designs (such as finance, hr, sales; ws_dev, ws_stg, ws_prod; bronze, silver, gold).

Approach 1: Parallel Environments with Read-Only Federation

Treat Unity Catalog as a new system and spin up new workspaces.

  • Pros: Clean start and clear separation

  • Pros: Parallel run makes testing easier

  • Pros: Separate responsibility – HMS publishing only in dedicated workspace

  • Pros: Transition can be chunked into phases easily

  • Cons: Not practical with 100s–1000s of workspaces

  • Cons: May require more user enablement

  • Cons: Can't leverage in-place upgrade tools

Approach 2: 1:1 HMS to Catalog Mapping

Upgrade your existing workspace to Unity Catalog by mapping data from hive metastore onto a singular catalog per HMS.

  • Pros: No new infrastructure

  • Pros: Easier automation with in place upgrade tools (UCX, Sync)

  • Pros: Test as you go

  • Pros: Lower user enablement (familiar environment)

  • Cons: Dependencies can be harder to discover

  • Cons: Harder to detect when you are finished, or catch users using out of date practices

  • Cons (Important): Revoke access to HMS for users to prevent working practice fallbacks

Approach 3: Full Migration and Modernisation

Upgrade within your existing environments directly onto your target UC architecture (such as finance, hr, sales; ws_dev, ws_stg, ws_prod; bronze, silver, gold).

  • Pros: No partial migration

  • Pros: Easy to plan (X catalog planned for...)

  • Pros: Easy to automate

  • Pros: Easy to work with federated ownership models

  • Cons: User learning curve for new data organisation

  • Cons: Hidden dependencies can break workflows

  • Cons: Can lock in rough edges on catalog design

Planning a Migration

The importance of planning ahead.

  • Know before you go: What is your approach?

  • Know before you go: Modernise as you go, incremental shift, parallel run?

  • Know before you go: Do you use this opportunity to clean up and modernise your lakehouse, or are you just looking to switch UC on?

  • Know before you go: Managed vs external tables?

Best Practices for Planning

  • Involve Stakeholders early: UC migration can't be done isolated to a team.

  • Involve Stakeholders early: Involve all stakeholders early in the discussion.

  • Involve Stakeholders early: Work with UC SME specialists and product teams to prioritize any product features.

  • Conduct Architecture reviews: Conduct an architecture review prior to UC migration.

  • Conduct Architecture reviews: Helps find out architectural flaws like not using customer VPC or using IAC for platform.

  • Conduct Architecture reviews: Always fix issues that can be fixed upfront that impacts large scale migrations like Unity catalog.

  • Discover consumption patterns: Identify all consumption patterns from HMS.

  • Discover consumption patterns: Assess if all are supported in UC.

  • Discover consumption patterns: Propose workarounds for unsupported patterns.

  • Discover consumption patterns: Raise product blockers for unsupported patterns without any workaround.

  • Have a rollback strategy: Things can go wrong fast in a production deployment.

  • Have a rollback strategy: Have the entire code deployment only through a ci/cd process.

  • Have a rollback strategy: Keep HMS and UC running in parallel.

  • Test everything: Avoid only testing code in repo or only testing scheduled jobs.

  • Test everything: Ensure testing covers jobs hidden from daily schedules, code not stored in repo, non standard code practices, consumption patterns, cluster compatibility, and performance degradations.

  • Have oversight on the process: Customer/partner could be doing the majority of work.

  • Have oversight on the process: The account teams should have an oversight of the program.

  • Have oversight on the process: Plan for production migration should have extended PS/DSA support.

Key Concepts: Table Types & Admin Roles

Table Types

  • Foreign Tables — Which catalog source of truth? Foreign Catalog.

  • Foreign Tables — How to create? Set up federation with another catalog.

  • Foreign Tables — Access from external tools: Supported.

  • Foreign Tables — Write from functionality: No (read-only).

  • Foreign Tables — Auto performance optimizations: No.

  • Foreign Tables — Auto storage cost reductions: No.

  • UC External tables — Which catalog source of truth? None (file system only).

  • UC External tables — How to create? Create a table with a set location (e.g., CREATE OR REPLACE TABLE main.default.my_tbl LOCATION 's3://path/to/table').

  • UC External tables — Access from external tools: Supported (via path-based access).

  • UC External tables — Write from functionality: Supported.

  • UC External tables — Auto performance optimizations: No.

  • UC External tables — Auto storage cost reductions: No.

  • UC Managed Tables — Which catalog source of truth? Unity Catalog.

  • UC Managed Tables — How to create? Create a table! (e.g., CREATE OR REPLACE TABLE main.default.my_tbl).

  • UC Managed Tables — Access from external tools: Supported.

  • UC Managed Tables — Write from functionality: Supported.

  • UC Managed Tables — Auto performance optimizations: Supported.

  • UC Managed Tables — Auto storage cost reductions: Supported.

  • Note: Streaming Tables (STS) & Materialized Views (MVs) are also considered to be UC managed tables.

Scope of Control for Administrators

  • Account Admin (Central Team): Can create workspaces

  • Account Admin (Central Team): Can create & configure metastores

  • Account Admin (Central Team): Can create users, groups, & service principals

  • Account Admin (Central Team): Can grant users access to workspaces

  • Account Admin (Central Team): Can set billing budget threshold alerts

  • Workspace Admin: Can add users and groups to workspace

  • Workspace Admin: Can create clusters & cluster policies

  • Workspace Admin: Can change OWNER of clusters, workflows, notebooks, queries, dashboards

  • Metastore Admin (Optional): Can create CATALOG, CREDENTIAL, EXTERNAL LOCATION

  • Metastore Admin (Optional): Can create SHARE, RECIPIENT

  • Metastore Admin (Optional): Can change OWNER of any securable object

  • Data Owner: Can change ownership of securable object (CATALOG, SCHEMA, TABLE, VIEW, etc.)

  • Data Owner: Can grant any privilege to any principal

Shaping a Plan: Execution Phases

Breaking down the steps.

  • Plan on a page (reach out to your account team for more details) — Qualify (1-2 Weeks): Qualify Readiness - Profile your usage to determine which elements can be upgraded today, vs later.

  • Plan on a page — Plan: Plan the Upgrade - Create a plan for your upgrade journey.

  • Plan on a page — Activate (1 - 2 Weeks): Activate Identity & UC - Perform the one-time setup tasks to enable Unity Catalog.

  • Plan on a page — Upgrade (2 - 4 Weeks Per Business Group): Upgrade Workloads - Execute upgrade of individual workloads.

  • Plan on a page — Validate (Per Business Group): Validate Upgrade - Validate that workloads have been upgraded and deprecate old references.

Phase Details

  • Qualify — Understand your organisations usage today: How many clouds/regions? Number of workspaces? Number of managed tables vs external tables? How many unique business units or teams? Workspace assets to migrate.

  • Qualify — Track environment details (1 UC Metastore per Cloud Region): Cloud, Region, # Workspaces, # External Tables, # Managed Tables.

  • Qualify — Identify which Business Groups use the platform: Priority, Business Group, # Workspaces, Main Point of Contact.

  • Qualify — Identify critical workloads and which systems they interact with: Business Group, Workspace Id, Workflow, Runtime, Upstream, Downstream.

  • Plan: Who needs to engage and when?

  • Plan: Enablement & Communications

  • Plan: Security model mapping and ownership

  • Plan: Data mapping from HMS to UC

  • Plan: Roll back plan

  • Plan: Technical tests to prove capability works

  • Activate: Create and attach metastore

  • Activate: Set up identity provider sync

  • Activate: Create administrative groups

  • Activate: Set up external locations, credentials, secrets, catalogs and schemas, volumes for user access to unstructured data

  • Activate: Set up initial permissions

  • Upgrade: Chunk work into priority / complexity based blocks

  • Upgrade: Migrate unsupported tables to external

  • Upgrade: Test everything!

  • Upgrade: Upgrade workflows and tables

  • Upgrade: Remove permissions to legacy services to test with easy reversion

  • Validate: Test user access

  • Validate: Test permissions

  • Validate: Test connected services

  • Validate: Does data look the same?

  • Validate: Test jobs, workflows, dashboards

  • Validate: Do people have the access they need?

Prioritizing Workloads

Start with low hanging fruit: review the outputs from UCX and SYNC DRY RUN.

  • Easy to automate: Delta External Tables (rather than managed tables)

  • Easy to automate: Delta Tables updated via batch (rather than streaming; including autoloader)

  • Easy to automate: Delta Tables used in DBSQL (rather than tables mostly used for ML)

  • Requires oversight: HMS managed and non-delta tables

  • Requires oversight: DLT and streaming pipelines

  • Requires oversight: ML Workloads

  • Requires oversight: External connections (jdbc etc)

Migration Tooling

What tools are available and when to use them?

UCX

Assess, track and automate your migration (Interactive UCX demo available).

  • Key feature: Assessment workflow

  • Key feature: Tracks state for assets, including permissions and ownership

  • Key feature: Automation of upgrade

  • Assessment Dashboard Metrics & Readiness Breakdown: Overall readiness metrics include UC readiness percentage, Total Databases, Metastore Crawl Failures, Total Tables, and Storage Locations.

  • Assessment Dashboard Metrics & Readiness Breakdown: Readiness by object type tracks pipelines, clusters, jobs, tables, and global init scripts.

  • Assessment Dashboard Metrics & Readiness Breakdown: Failure summary identifies issues such as Data is in DBFS Mount, Data is in DBFS Root, unsupported DBR versions (e.g., 11.1.x-scala2.12, 10.4.x-cpu-ml-scala2.12), and Non-DELTA formats (e.g., csv, parquet).

  • Assessment Dashboard Metrics & Readiness Breakdown: Database and table summaries detail storage formats, locations (such as dbfs:/user), unsupported dbfs_root tables, total grants, granted principals, and categorize tables into In Place Sync vs. Replication Required.

The SYNC Command

sync table | schema from hms_location <dry run>

  • Key feature: Use dry run to evaluate readiness.

  • Key feature: Then, automatically upgrade eligible tables.

  • Dry Run Output Example: Evaluates source schema (fe_slc_squirrels), source name (park_data, squirrel_data), source type (managed), target catalog (main), target schema, and target name.

  • Dry Run Output Example: Flags ineligible tables with a status code (DBFS_ROOT_LOCATION) and description ([UPGRADE_NOT_SUPPORTED.DBFS_ROOT_LOCATION] Table is not eligible for upgrade from Hive Metastore to Unity Catalog. Reason: Table located on DBFS root. SQLSTATE: 0AKUC).

Official Routes for Upgrading Tables to UC

  • SYNC table: Upgrade external tables from HMS to external tables in UC. Does not copy data; alters metadata of the table. Preserves history. Use cases: Upgrading to UC without duplicating data.

  • DEEP CLONE table: Creates an independent copy of a delta table. Does not preserve history; creates new history as it's a new table (but it is traceable!). Efficient - Supports incremental update from the source. Use cases: DR and HA scenarios, migration and copy of data without history, point in time sharing.

  • CREATE TABLE AS table: Naive independent copy by read-writing against any selectable object. Highly flexible on source type. Does not preserve history. Fast initial run but no native incremental support. Use cases: DR and HA scenarios, migration of scenarios not covered by deep clone.

HMS to UC Clone API for Declarative Pipelines

Endpoint: /api/2.0/pipelines/<pipeline id>/clone

  • Migrates pipelines reading from sources like Delta, Auto Loader, Kafka, and Kinesis from Hive Metastore to Unity Catalog (catalog.schema).

  • Copies code, configurations and allows new overrides.

  • Updates object definitions to Unity Catalog.

  • Migrates existing data and checkpoints.

  • Streaming pipelines continue from checkpoint.

Common Challenges & Solutions

What scenarios do we typically see and what to do?

Cloud Resources & Access Modes

Usage of roles: accessing Cloud resources other than storage.

  • Cloud credentials workflow: Users execute code in a Notebook to access a cloud service.

  • Cloud credentials workflow: Unity Catalog manages a Service credential and issues a Temporary credential to the Notebook.

  • Cloud credentials workflow: The Notebook uses these temporary credentials to securely access external cloud services such as DynamoDB (dynamo) or AWS Lambda (lambda).

Table Migration Methods & Decision Tree

Decisions: History required? Duplication of data or in-place? One-time vs continual replication?

  • Path 1 — Hive Metastore Managed table -> Underlying storage: Dbfs root -> Target storage: Cloud storage* (different to original location): Deep clone or CTAS (Recommended routes; creates a new history log), or File copy (Preserves history; requires a manual approach).

  • Path 2 — Hive Metastore Managed table -> Underlying storage: Cloud storage -> Target storage: Cloud storage* (different to original location): Deep clone or CTAS (Recommended routes; creates a new history log), or File copy (Preserves history; requires a manual approach).

  • Path 3 — Hive Metastore External table -> Underlying storage: Cloud storage -> Target storage: Cloud storage* (different to original location): Deep clone or CTAS (Recommended routes; creates a new history log), or File copy (Preserves history; requires a manual approach).

  • Path 4 — Hive Metastore External table -> Underlying storage: Cloud storage -> Target storage: In place: Sync (Recommended route; preserves history; is not a copy and is not used for backup strategies).

Code Refactoring

  • Leverage the default catalog option: Moving from a 2-tier namespace to 3 in UC introduces a requirement for minor code refactoring.

  • Leverage the default catalog option: You can leverage the default catalog setting to ease transition.

  • Leverage the default catalog option: Example workflow: A statement like create table my_schema.example previously targeting my_schema in Hive metastore can automatically map to my_schema inside a designated Migration catalog in Unity Catalog without immediate code changes.

  • Common code issue: Challenge: Usage of RDDs -> Solutions: Refactor to use Dataframes API; Use dedicated access mode cluster.

  • Common code issue: Challenge: Usage of mount points, DBFS -> Solution: Volumes.

  • Common code issue: Challenge: IAM roles or service profiles -> Solution: Switch to service credentials.

Cluster Access Modes

Working securely with your governed lakehouse.

  • Standard cluster is your default compute.

  • If shared clusters don't work, use dedicated access mode for individuals or groups.

  • Develop & deploy using the same access mode.

Closing

Thanks for joining us.

Top comments (0)