Skip to main content

Validate migrated data with Genie Migrate

Beta

This feature is in Beta. To use it, a workspace admin must turn on Migration Projects Experimental Features from the Previews page. See Manage Databricks previews.

This page describes how to use Data Validation in Genie Migrate to confirm that tables you migrated from SQL Server or Azure Synapse to Databricks match the source. Data Validation compares each source table with its migrated Unity Catalog table. It checks that row counts match, then finds rows that exist on only one side and the column values that changed.

To validate migrated tables:

  1. Connect the source and target catalogs.
  2. Add the source tables to validate.
  3. Choose the target table for each source table, and set how its columns are compared.
  4. Run comparisons.
  5. Review the results.

How Data Validation works​

Data Validation reads the source tables through a Lakehouse Federation connection, so your source data isn't copied into Databricks. Each comparison runs as a job on serverless compute and compares one source table with one target table. You can run a comparison in one of two ways:

  • Count: Compares the row counts of the source and target tables. This is the faster check.
  • Count + Data diff: Compares the row counts, then compares every row and reports the values that changed. This check takes longer on large tables.

Every comparison run starts with a schema check. The schema check confirms that both tables exist and pairs their columns, using your column mapping or matching column names. For each column that isn't excluded, it also confirms that a built-in rule or a custom rule can compare the pair.

The schema check fails when a source column or a key column has no target column, when your configuration names a column that a table doesn't have, or when a column pair has no rule that can compare it. If the schema check fails, a Count run still compares row counts, but a Count + Data diff run skips the data diff. To fix it, add a column mapping, a custom rule, or an exclusion to the table pair's configuration. If a table doesn't exist, nothing is compared.

A data diff matches rows by their key columns. When you set key columns for a table pair, Data Validation joins source and target rows on their keys and lists a sample of up to 1,000 changed rows, with the columns that differ. Without key columns, it compares whole rows. It reports how many rows exist on only one side, but it can't list those rows or name the columns that changed.

Column values are compared by built-in rules for each pair of source and target data types, and values must match exactly under those rules. For a column whose values the migration changed on purpose, such as a reformatted date, write a custom rule. See Step 3: Configure each table pair.

Prerequisites​

  • A migration project with T-SQL as the source dialect. The Data Validation tab appears only in T-SQL projects. See Create a migration project.
  • A Lakehouse Federation connection of type SQL Server to your source, and a foreign catalog for that connection. See Run federated queries on Microsoft SQL Server. For Azure Synapse, use a connection of type SQL Server that points to your Azure Synapse dedicated SQL pool.
  • The migrated tables in a Unity Catalog catalog.
  • The USE CONNECTION privilege on the source connection.
  • The USE CATALOG, USE SCHEMA, and SELECT privileges on the foreign catalog for your source connection. You need them to see and browse the foreign catalog in Data Validation.
  • The USE CATALOG, USE SCHEMA, and SELECT privileges on the target catalog, or ownership of the catalog. SELECT on individual tables isn't enough.
  • Serverless compute enabled for your workspace. See Connect to serverless compute.
  • Network access from serverless compute to your source. Your SQL Server or Azure Synapse firewall must allow traffic from your workspace's serverless compute. See Serverless compute plane networking.

To set up Data Validation, add tables, configure comparisons, or run them, you need edit access to the migration project. You also need the source and target privileges listed above, even if someone else set up Data Validation.

Who can see results and run comparisons​

Data Validation saves its results in the project's destination folder. The results include sample values from rows that differ. To keep the results private, create the migration project in your home folder and choose a destination folder in your home folder too.

If the project or its destination folder is shared, other users can see and use Data Validation:

  • View: Anyone who can view the project can see its runs and their verdicts. Anyone who can view the destination folder can open the full results, including the sample values. Viewing results doesn't require any privileges on the source connection or the target catalog.
  • Run: Anyone who can edit the project and has the required privileges can add tables, configure comparisons, and run them.
  • Admins: Workspace admins can access every migration project.

Comparisons run with the access of the user who set up Data Validation, no matter who starts the run. A collaborator's comparison reads the tables with that user's permissions. If that user loses access to the source connection or the target catalog, comparisons in the project stop working for everyone.

Validate migrated tables​

Step 1: Connect the source and target catalogs​

Each migration project has one Data Validation setup, which connects one source foreign catalog to one target catalog. Data Validation reads table metadata from the foreign catalog, so make sure the foreign catalog is up to date before you start.

  1. In your T-SQL migration project, click the Data Validation tab.
  2. Click Start configuration.
  3. For Source connection, select the Lakehouse Federation connection to your source. Only connections of type SQL Server are listed.
  4. If your source is an Azure Synapse dedicated SQL pool, select The source is Azure Synapse. Data Validation then applies optimizations for Azure Synapse. This setting doesn't change the results.
  5. For Source foreign catalog, select the foreign catalog for that connection, which holds the tables you migrated from.
  6. For Target catalog, select the Unity Catalog catalog that you migrated the tables to.
  7. Click Start Data Validation.

Data Validation configuration form with a source connection, The source is Azure Synapse selected, a source foreign catalog, a target catalog, and the Start Data Validation button.

note

You can't change the Azure Synapse setting, the source foreign catalog, or the target catalog after you start Data Validation.

Step 2: Add tables​

  1. On the Configuration tab, click Add tables.
  2. Search for source tables by database, schema, or table name, and select the tables to validate. You can add up to 250 tables.
  3. Click Add tables.

If the tables you need aren't listed, refresh the foreign catalog's metadata, for example with REFRESH FOREIGN CATALOG, and then add the tables again. See REFRESH FOREIGN (CATALOG, SCHEMA, and TABLE).

Each added table appears in the Table Mappings list. A table shows Needs a target until you choose the migrated table to compare it with.

Step 3: Configure each table pair​

  1. In the table's row, click Gear icon. Configure.
  2. In Configure comparison, select the Target schema and Target table that the source table was migrated to.
  3. (Optional) In the columns list, set how each column is compared:
    • Key: Use the column to match source and target rows. Set key columns to see which rows and columns differ.
    • Exclude: Leave the column out of the comparison, such as a load timestamp that only exists in the target.
    • Compared by: Shows the rule that compares the column. To give the column a custom rule, click Write rule. Enter a Source SQL (SQL Server) expression and a Target SQL (Databricks SQL) expression, using {} for the column. Both expressions must return equal values for equal data.
  4. (Optional) To compare only some rows, enter a Source filter (SQL Server) and a Target filter (Databricks SQL), such as region = 'EMEA'.
  5. Click Save.

Data Validation pairs columns that have the same name in the source and target automatically, even if the case differs. If a column was renamed, enter its Target column.

By default, Data Validation compares each column that has no custom rule by its built-in rule. If you turn off Compare columns by their built-in rules, those columns are compared as text, so formatting differences such as 1.0 and 1 show as changes. Key columns are compared as stored. If the migration changed a key column's values, give it a custom rule.

If the source table's columns don't appear, Unity Catalog hasn't read the table yet. Run DESCRIBE TABLE on the source table in the SQL editor, and then click Refresh in Configure comparison.

Step 4: Run comparisons​

  1. Select the table pairs to compare, and click Run. To compare one table pair, click Play icon. in its row instead.
  2. Select Count or Count + Data diff.

You can select only table pairs that have a target table. Up to 20 comparisons can run at the same time for each source connection. Comparisons beyond that limit don't start. Run them again after some finish.

Step 5: Review the results​

The Table Mappings list shows each table pair's latest Verdict and its Recent runs.

Data Validation Configuration tab showing the source and target catalogs and the Table Mappings list, with one table pair at Mismatch, one at Match, and three that need a target.

To see every run, click the Runs tab. For each run, the Runs tab shows the Run status, the Count check and Data diff check results, and an overall Verdict.

Each check has one of the following results:

  • Match: The check found no differences between the source and target.
  • Mismatch: The check found differences.
  • Couldn't compare: The schema check failed, so the check couldn't run. For example, a table is missing, or a key column has no matching target column. See How Data Validation works.
  • Not run: The run didn't include the check, such as the data diff in a Count run.

The verdict is Couldn't compare if either check couldn't run. Otherwise, it's Mismatch if either check found differences, and Match if neither did. To see the differences, click View on a run. The run details show the following:

  • Row counts for the source and the target.
  • Columns that exist in both tables, columns that exist in only one, and columns whose types may lose data or are incompatible.
  • Rows that exist only in the source, rows that exist only in the target, and duplicate keys.
  • Rows with changed values, with the source and target value of each changed column.

Run details for a table pair with a Match count check and a Mismatch data diff check, and a Source and target table that shows 11 rows with changed values.

A run keeps up to the first 1,000 keys of each kind of difference. To see the run's full results, click Open results.json, which opens the results file in your workspace. To stop a run that is in progress, click Stop.

note

A Match on a Count run shows only that the row counts are equal. Run Count + Data diff with key columns set to confirm that the row values match.

Limitations​

  • Data Validation supports SQL Server and Azure Synapse sources, in T-SQL migration projects only.
  • Each migration project has one Data Validation setup, with one source foreign catalog and one target catalog.
  • A Data Validation setup can contain up to 250 tables.
  • Up to 20 comparisons can run at the same time for each source connection.
  • Values must match exactly under the built-in or custom rules. Data Validation has no numeric tolerance.
  • Comparisons run when you start them. You can't schedule them or compare only rows that changed since the last run.
  • A run keeps up to the first 1,000 keys of each kind of difference, such as rows only in the source or rows with changed values.
  • Data Validation writes results as JSON files in your workspace. It doesn't write them to tables.
  • If the user who set up Data Validation loses access to the source connection or the target catalog, comparisons in the project stop working for everyone.

Additional resources​