Validate a PostgreSQL to Databricks migration
Validate a PostgreSQL table against its migrated Databricks table by agreeing on identity, cutoff and column meaning before running a diff. This is a supported-configuration playbook based on the shipped PostgreSQL and Databricks connectors; it is not a verified live benchmark of this cross-engine pair.
1. Write the comparison contract
For an orders table, record a mapping such as sales.orders in the PostgreSQL database app to main.sales.orders in Databricks. Specify order_id as the unique, non-null comparison key. Record the actual table names, mapped columns, row scope, source snapshot or reconciled extraction cutoff, and approved transformations in the downloadable checklist.
Stop if either side contains duplicate or null keys. A declared key is not evidence that migrated rows are unique. Check uniqueness against the exact partition you will compare. If writes continue, reconcile the extraction watermark on both sides; two query start times do not create a shared snapshot.
2. Establish read access
Create and test the PostgreSQL connection and Databricks connection. The PostgreSQL role needs connection access, schema usage and read access to the chosen objects. For Databricks, the principal needs USE CATALOG, USE SCHEMA, SELECT on each compared object, and access to the SQL Warehouse. See Databricks permissions.
Use the complete catalog.schema.table name on Databricks. Quote each part with backticks when necessary, including names containing hyphens. Confirm the connection's catalog/schema filters expose the intended objects. Compare access does not require write access to the migrated tables.
3. Configure one table pair
Follow Data Source Diff using PostgreSQL as Source and Databricks as Target. Map the tables and columns explicitly; review automatic suggestions before accepting them. Select the Databricks key yourself: DataDios does not read its primary-key constraints.
Prepare snapshot or staging tables containing the same agreed, bounded partition on both sides. Data Source Diff metadata filters do not apply row-level cutoffs; use Query Diff with equivalent WHERE predicates when you need to scope rows in the comparison queries. Keep the raw columns included until you have explained each mismatch. Record excluded columns and why they do not affect the acceptance decision. Resolve workflow validation errors, run the comparison, then inspect row differences as well as metadata and summary results.
4. Review type meaning before normalizing
| Concern | Validation decision |
|---|---|
| Decimal precision | DataDios maps decimal comparison values to double precision. A clean diff alone cannot establish exact high-precision decimal equality. Reconcile exact decimal values separately with database-native checks, or compare a deliberately specified canonical decimal text representation. |
| Timestamp meaning | Databricks TIMESTAMP represents an instant; TIMESTAMP_NTZ is wall-clock time. Specify the source timezone, precision and conversion rule. Never remove offsets merely to make display strings match. |
| Null and empty text | Treat them as distinct unless an approved business rule says otherwise. Retain both original values. |
| Nested columns | Handle arrays, maps, structs and variants in a separate, explicitly defined projection; do not infer semantic equality from their generic metadata type. |
| Column case | The diff matches names without regard to case. Resolve ambiguous case-only column names before mapping. |
See mismatch investigation and Databricks type handling. The browser sample in the kit compares CSV text only and does not model these engine conversions.
5. Budget reads and inspect the full scope
Data Source Diff reads counts, key ranges and ordered batches. It needs a compatible batchable key type on both sides; otherwise a large table can be read whole. Batch size is a target for key-range planning, not a hard maximum number of rows in memory. Skewed or sparse keys can produce large batches. Query Diff streams ordered query results, but the database still performs the query and sort.
Read the batching limits before scaling. Databricks queries consume SQL Warehouse compute and may start an idle warehouse. Validate every agreed partition and retain a partition manifest; a sample establishes only what was examined.
6. Reconcile and decide
Account for unchanged rows, changed rows, missing source keys and unexpected target keys. Check business totals within meaningful groups such as currency and status, using exact-decimal checks where required. Explain metadata differences rather than expecting identical native type names across engines.
Repair migration defects through your migration process, rerun affected partitions and retain before/after evidence. Record unresolved exceptions and a named owner. A clean data result does not validate application behavior, performance, permissions or rollback readiness.
Rehearse with the PostgreSQL lab and use the synthetic report as a reporting template.
Review your PostgreSQL to Databricks validation plan