Search GimmeJob

Type at least 2 characters. Enter also searches by meaning.
QA interview question
Databases, SQL & BIData / ETL / BIMiddleCommonScenario

How would you validate source-to-target mappings and data lineage across a transformation pipeline?

Answer

Start with a versioned mapping that identifies each source field, transformation rule, target field and allowed exception. Test representative rows and aggregate reconciliations at every boundary so a discrepancy can be localized instead of discovered only in the final report. Include rejected records, defaults, type conversions, joins and lineage metadata, then retain evidence that connects the source input to the published result.

Strong answer includes

  • uses a versioned field-level mapping as the oracle
  • combines row-level checks with aggregate reconciliation
  • preserves traceable evidence through every transformation

Practical example

Locate source-to-target row differences
Dialect · SQL standardRuntime · static example

Requires source and warehouse tables at the declared business-key grain.

SELECT
  COALESCE(s.order_id, t.order_id) AS order_id,
  s.amount AS source_amount,
  t.amount AS target_amount
FROM source_orders s
FULL OUTER JOIN warehouse_orders t ON t.order_id = s.order_id
WHERE s.order_id IS NULL
   OR t.order_id IS NULL
   OR s.amount IS DISTINCT FROM t.amount;

A full comparison exposes rows missing on either side plus changed values at the declared business-key grain. Use the versioned mapping as the oracle: if the target amount is transformed, compare it with an independently calculated expected value rather than blindly expecting source equality.

Expected result: Only explainable mapped differences; unexplained rows identify the pipeline stage to investigate.

#database#etl#lineage#mapping

Sources

Add data tests to your DAGdbt Labs · Reusable assertions for analytics transformations and data contractsDevelop and test Dataflow pipelinesGoogle Cloud · Unit, integration and end-to-end testing for batch and streaming pipelinesUnderstand star schema and its importance for Power BIMicrosoft · Facts, dimensions, grain, relationships and semantic-model quality