Lesson 4 of 5 Schema Evolution and Data Lineage

Tracing Data Lineage from Source to Report

This lesson explains data lineage, which records data's path from source through each transformation to final datasets and reports, answering where a number came from and what would break if something changed.

Learning outcomes

After completing this lesson, you will be able to:

  • Identify the questions lineage answers.
  • Identify the lineage tools on AWS.
  • Capture lineage automatically rather than by hand.

What lineage supports

Data lineage records where each dataset came from and how it was transformed on the way. It answers several kinds of question. For impact analysis, it shows what will break if a column changes, by listing every downstream table, report and model that uses it. For debugging, it traces a wrong value back through each transformation to its source.

Lineage also supports trust and audits, by providing evidence of how regulated figures, such as reported revenue, were produced. And it helps with privacy obligations, by finding every copy of personal data so that requests to delete a person's data can be honoured everywhere.

Match the pairs

Uses of lineage

Exam skills 2.4.4

Match each use of lineage with the question it answers.

Log in to try this activity Interactive activities are free with an account.

Lineage tools on AWS

Data lineage records where data came from and what produced it, so you can trace an error back to its source or see which reports a change would affect. Amazon SageMaker Catalog, part of SageMaker Unified Studio and built on Amazon DataZone, captures lineage for data assets from Glue jobs, Redshift and OpenLineage events, and shows it alongside business metadata such as owners and descriptions. SageMaker ML Lineage Tracking records the steps of machine learning workflows, linking datasets, processing and training jobs, models and endpoints, so you can show which data trained a model. The following table summarises the tools.

ToolTracks
Amazon SageMaker Catalog (Unified Studio, built on DataZone)Asset lineage captured from Glue, Redshift and OpenLineage events, shown with business metadata
SageMaker ML Lineage TrackingDatasets, processing and training jobs, models and endpoints in ML workflows
Match the pairs

Lineage tools

Exam skills 2.4.4

Match each lineage need with the AWS tool.

Log in to try this activity Interactive activities are free with an account.

Capturing lineage

Lineage is only useful if it is accurate, and lineage documented by hand in diagrams and documents becomes outdated as soon as a pipeline changes. It is most reliable when captured automatically as pipelines run.

AWS Glue jobs and Amazon Redshift queries can emit lineage to Amazon SageMaker Catalog, which records which datasets each job read and wrote and displays the result as a graph. Other tools, such as Apache Airflow or Spark jobs on Amazon EMR, can send OpenLineage events, an open standard for lineage, through the catalogue's API, so lineage from different engines is combined into one view.

The following diagram shows the lineage chain a team traces behind a revenue figure on a dashboard.

Tracing the revenue figure through its lineage. The dashboard dataset reads the curated revenue table, which a Glue job builds from the cleaned orders table, which another Glue job builds from raw orders replicated by a DMS task from the ERP database. Following the chain in SageMaker Catalog shows that a filter in the curated job excluded one region's refunds.
The scenario is illustrative.
Worked example

Answering "where did this number come from?"

A finance director questions a revenue figure on a dashboard. The data team must show which sources and transformations produced it. The following table lists the lineage source for each layer.

LayerLineage source
Dashboard datasetQuick Sight dataset definition
Curated revenue tableGlue job and SQL, versioned in Git
Cleaned orders tableGlue job recorded in SageMaker Catalog lineage
Raw ordersDMS task from the ERP database

With lineage captured in SageMaker Catalog, the team traces the figure back in minutes and finds that refunds from one region were excluded by a filter. Without lineage, the same investigation would mean reading code across several repositories.

Check yourself

Which question does lineage answer for an engineer about to change a column?

Show answer

What breaks if the column changes: which jobs, tables and reports depend on it.

Exam Tips

Remember for the exam

  • Asset lineage for governance and impact analysis points to SageMaker Catalog.
  • Lineage of ML datasets, jobs and models points to SageMaker ML Lineage Tracking.
  • Lineage answers the question "what breaks if this column changes?".
  • OpenLineage events let other tools contribute lineage.
  • Capture lineage automatically as pipelines run.