Back to Glossary Index


Understand of how data moves through a pipeline, including its origin, transformations, dependencies, and ultimate consumption.

Data Lineage definition:

Data lineage refers to the visualization and understanding of how data moves through an ecosystem, including its origin, transformations, dependencies, and ultimate consumption. Effective data lineage provides a clear and comprehensive view of where data comes from, how it moves and changes, and where it ends up within a system or workflow.

Lineage is a critical concept in data engineering, data analysis, and data governance.

Here's a breakdown of the concept:

  1. Origin or Source: Where does the data come from? This could be databases, external systems, flat files, APIs, or other sources.

  2. Transformations: As data moves from its origin to its final destination, it might go through various transformations. This could be an ETL (Extract, Transform, Load) processes, data cleaning operations, or any other type of manipulation a data engineer or data scientist might define.

  3. Dependencies: Understanding what datasets, processes, or tools depend on each other is key. If a source changes or has an issue, it's vital to know what downstream processes or datasets might be affected.

  4. Consumption: This refers to the final resting place of the data or where it gets consumed. It might end up in a data warehouse, a report, a machine learning model, or any other type of application or system.

Why is data lineage important?

  1. Trust & Data Quality: Understanding the full path of data helps ensure data quality and build trust in the data. If there's an anomaly in a report, you can trace back to see where the data came from and how it was transformed.

  2. Impact Analysis: If a system or process needs to change, data lineage can show what downstream processes or datasets might be affected.

  3. Compliance & Audit: Many industries have regulatory requirements around data. Knowing the full lineage of data can help ensure compliance, as you can demonstrate where data comes from and how it's used.

  4. Optimization & Debugging: Having a clear understanding of data lineage speeds up troubleshooting.

  5. Knowledge Sharing: For large organizations, not everyone might be aware of all data processes. You might have data scientists, data engineers, software engineers and data architects all collaborating on building data pipelines. Data lineage provides a clear map for everyone to understand the data flow, and hels answer pointed questions from data consumers.

To sum this up, data lineage is all about transparency, trust, and understanding in a data-driven ecosystem. Given the increasing complexity of modern data pipelines and the critical importance of data in decision-making, maintaining clear lineage is essential for most organizations and data teams.

Data lineage in Machine Learning

Lineage plays a significant role in machine learning (ML). Given that machine learning models are data-driven, understanding where data comes from, how it's processed, and how it's used is crucial for both model development and deployment. Here's an exploration of the role of data lineage in machine learning:

  1. Reproducibility: One of the data engineering challenges in ML is ensuring that results (model training, evaluations, predictions) can be reproduced. Knowing the lineage of the data used to train and test a model provides clear documentation of the data's origins and the transformations it underwent, which is essential for reproducing results.

  2. Model Interpretability: If an ML model produces unexpected or erroneous results, understanding lineage can help pinpoint potential issues in the data sourcing or preprocessing stages that might be contributing to the problem.

  3. Model Auditing: For regulatory and compliance purposes, organizations might need to audit ML models, especially in critical domains like finance or healthcare. Data lineage provides a trail of evidence showing where the model's data originated and how it was processed, aiding in transparency and accountability.

  4. Data Quality Assurance: Poor data quality can significantly degrade the performance of ML models. Tracking data lineage allows teams to trace back and identify sources of noise, missing values, or anomalies that might affect model quality.

  5. Feature Engineering: Features, derived from raw data, play a crucial role in ML. Understanding the lineage of features—how they were derived, transformed, and encoded—is essential for model tuning and optimization.

  6. Model Versioning: Just as code versioning is crucial in software development, model versioning is essential in ML, and lineage is a significant part of this. If you retrain a model on new data or with different preprocessing, tracking lineage can help you understand differences between model versions.

  7. Collaboration & Knowledge Transfer: ML teams often comprise multiple roles - data engineers, data scientists, ML engineers, and domain experts. A clear understanding of data lineage ensures that all team members have a shared understanding of the data, its sources, and its transformations.

  8. Operational Monitoring: After deploying an ML model, it's crucial to monitor its performance. If the model starts to drift or produce unexpected results, data lineage can help teams quickly determine if changes or anomalies in input data might be the cause.

  9. Bias & Fairness: Ensuring models are fair and unbiased is crucial. Successful ML engineering means tracing potential sources of bias in the data collection or preprocessing stages.

Data lineage in computer science provides transparency, traceability, and accountability. As ML models become increasingly integrated into critical applications, the need for clear documentation and understanding of data sources and transformations grows more vital. Data lineage tools and practices help meet this need.

Read more about orchestrating Machine Learning pipelines in Dagster.

Data Lineage Tools & Technologies:

Many data governance and data management tools offer data lineage features. These tools can automatically track and visualize data lineage, helping data engineers and architects understand complex data flows. Dagster builds data lineage directly into the orchestration process thanks to its unique asset-centric approach.

Coding example of data lineage in Python

Data lineage is a hard concept to capture in a single coding example, but we can illustrate the idea, even though real-world data engineering jobs involve more complexity and typically employ specialized tools.

Let's consider a data pipeline with multiple data sources and data processing stages. We'll use Python classes to encapsulate these stages and maintain lineage metadata along the way. We will mock a data warehouse and an API.

Here's a simple mock-up of a data pipeline that tracks lineage:

class DataSource:
    def __init__(self, name, data): = name = data
        self.lineage = [f"Source: {name}"]

    def get_data(self, user_id=None):
        if user_id is None:
            return, self.lineage
        return [record for record in if record['user_id'] == user_id][0], self.lineage

class Transformation:
    def __init__(self, name, function): = name
        self.function = function

    def apply(self, data, lineage):
        transformed_data = self.function(data)
        lineage.append(f"Transformed by: {}")
        return transformed_data, lineage

class DataSink:
    def __init__(self, name): = name

    def save(self, data, lineage):
        # For simplicity, we're just printing here.
        print(f"Data saved to {}: {data}")
        for step in lineage:
            print(" -> ", step)

# Mock multiple data entries for Database_A
data_entries_db_a = [
    {"user_id": 1, "name": "Thom Yorke", "use_case": "lead singer"},
    {"user_id": 2, "name": "Jonny Greenwood", "use_case": "guitarist"},
    {"user_id": 3, "name": "Ed O'Brien", "role": "guitarist"  },
    {"user_id": 4, "name": "Philip Selway", "role": "drums"},
    {"user_id": 5, "name": "Colin Greenwood", "role": "bass"}

# Mock multiple data entries for API call
data_entries_api_b = [
    {"user_id": 1, "born": "1968"},
    {"user_id": 2, "born": "1971"},
    {"user_id": 3, "born": "1968"},
    {"user_id": 4, "born": "1967"},
    {"user_id": 5, "born": "1969"}

source1 = DataSource("Database_A", data_entries_db_a)
source2 = DataSource("API_B", data_entries_api_b)

transform1 = Transformation("Merge Data", lambda data: {**data[0], **data[1]})
transform2 = Transformation("Add Status", lambda data: {**data, "status": "processed"})

sink = DataSink("Warehouse_X")

def pipeline():
    # Process each entry from Database_A
    for data1_entry in
        user_id = data1_entry["user_id"]
        data1, lineage1 = data1_entry, source1.lineage
        data2, lineage2 = source2.get_data(user_id)

        merged_data, merged_lineage = transform1.apply([data1, data2], lineage1 + lineage2)
        processed_data, final_lineage = transform2.apply(merged_data, merged_lineage), final_lineage)
        print("-----------------------")  # Separator for clarity


In this example:

  1. We've structured DataSource, Transformation, and DataSink classes to maintain lineage information.
  2. Each time data is pulled or transformed, its lineage is updated with relevant metadata.
  3. The pipeline combines data from two sources, applies two transformations, and then saves the data. The lineage is printed, showing the journey of the data.

The output of our example would be:

Data saved to Warehouse_X: {'user_id': 1, 'name': 'Thom Yorke', 'use_case': 'lead singer', 'born': '1968', 'status': 'processed'}
 ->  Source: Database_A
 ->  Source: API_B
 ->  Transformed by: Merge Data
 ->  Transformed by: Add Status
Data saved to Warehouse_X: {'user_id': 2, 'name': 'Jonny Greenwood', 'use_case': 'guitarist', 'born': '1971', 'status': 'processed'}
 ->  Source: Database_A
 ->  Source: API_B
 ->  Transformed by: Merge Data
 ->  Transformed by: Add Status

Naturally, real-world data pipelines would likely be more complex, involve permanent data storage, and might not involve Radiohead band members. Advanced data engineers would typically employ dedicated tools for data modeling and analyzing data, especially in larger data ecosystems with cloud computing.

A solution like Dagster naturally tracks lineage for you and provides the tools for data engineers to rapidly observe, track and debug data pipelines. Furthermore, data lineage is directly related to the set of dependencies that exist within data pipelines, and Dagster's built-in tracking of dependencies allows data engineers, software engineers, and data architects to tap into these when building data pipelines.

We hope this overview helps you in building your data engineering skills. Mapping data provenance will help manage your data processing systems, support data analysts, maintain solid data architecture, and keep track of sources like data warehouses and data lakes.

Other data engineering terms related to
Data Management:


Move rarely accessed data to a low-cost, long-term storage solution to reduce costs. store data for long-term retention and compliance.
An image representing the data engineering concept of 'Archive'
Dagster Glossary code icon


Add new data or information to an existing dataset to enhance its value.
An image representing the data engineering concept of 'Augment'


Create a copy of data to protect against loss or corruption.
An image representing the data engineering concept of 'Backup'
Dagster Glossary code icon

Batch Processing

Process large volumes of data all at once in a single operation or batch.
An image representing the data engineering concept of 'Batch Processing'
Dagster Glossary code icon


Store expensive computation results so they can be reused, not recomputed.
An image representing the data engineering concept of 'Cache'
Dagster Glossary code icon


Organizing and classifying data into different categories, groups, or segments.
An image representing the data engineering concept of 'Categorize'
Dagster Glossary code icon


Identify and remove duplicate records or entries to improve data quality.
An image representing the data engineering concept of 'Deduplicate'


Deserialization is essentially the reverse process of serialization. See: 'Serialize'.
An image representing the data engineering concept of 'Deserialize'
Dagster Glossary code icon


Analyzing the number of features or attributes in the data to improve performance.
An image representing the data engineering concept of 'Dimensionality'
Dagster Glossary code icon


Enhance data with additional information from external sources.
An image representing the data engineering concept of 'Enrich'


Extract data from a system for use in another system or application.
An image representing the data engineering concept of 'Export'
Dagster Glossary code icon


An operation that produces the same result each time it is performed.
Dagster Glossary code icon


Create an optimized data structure for fast search and retrieval.
Dagster Glossary code icon


Combine data from different sources to create a unified view for analysis or reporting.
Dagster Glossary code icon


Executing a computation and persisting the results into storage.
Dagster Glossary code icon


Store the results of expensive function calls and reusing them when the same inputs occur again.
Dagster Glossary code icon


Combine data from multiple datasets into a single dataset.
An image representing the data engineering concept of 'Merge'
Dagster Glossary code icon


Create a conceptual representation of data objects.


Track data processing metrics and system health to ensure high availability and performance.
Dagster Glossary code icon

Named Entity Recognition

Locate and classify named entities in text into pre-defined categories.
Dagster Glossary code icon


Interpret and convert data from one format to another.
Dagster Glossary code icon


Divide data into smaller subsets for improved performance.
An image representing the data engineering concept of 'Partition'
Dagster Glossary code icon


Transform your data so it is fit-for-purpose.
Dagster Glossary code icon


Transform raw data before data analysis or machine learning modeling.
Dagster Glossary code icon


Create a copy of data for redundancy or distributed processing.


Increasing the capacity or performance of a system to handle more data or traffic.
Dagster Glossary code icon

Schema Mapping

Translate data from one schema or structure to another to facilitate data integration.


Ensure that data in different systems or databases are in sync and up-to-date.
Dagster Glossary code icon


Check data for completeness, accuracy, and consistency.
Dagster Glossary code icon


Maintain a history of changes to data for auditing and tracking purposes.
An image representing the data engineering concept of 'Version'