> ## Documentation Index
> Fetch the complete documentation index at: https://docs.prophecy.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# View SQL lineage

> Track where output columns come from and how they were transformed in Prophecy.

SQL lineage helps you understand where data comes from in a pipeline. It traces which source table columns produced each output column and shows how those columns were transformed along the way.

Use SQL lineage when you need to inspect how a selected column was created, whether it passed through gems unchanged, or where it was modified in the pipeline.

## View column lineage in a pipeline

To view column lineage:

1. Select **Lineage** from the pipeline menu. A lineage panel opens at the bottom of the pipeline editor.
2. Select a dataset and column to see how the column was produced within the pipeline.

Prophecy highlights the gem where the selected column is created and displays the transformation logic used to generate it. For example, selecting `AVG_SPECIALIST_VISITS` highlights the Aggregate gem and shows the expression `ROUND(AVG(specialist_visits_expected), 2)` used to create the column.

<img src="https://mintcdn.com/prophecy-62973bd0/yksXglxyDT6Op90J/data-analysis/development/pipelines/img/sql-lineage.png?fit=max&auto=format&n=yksXglxyDT6Op90J&q=85&s=e408dc933ad60e9827394d2bfe415ae0" alt="view sql lineage" width="1552" height="1012" data-path="data-analysis/development/pipelines/img/sql-lineage.png" />

## Limitations

Prophecy cannot compute lineage for some Custom gems, such as the [Rest API gem](/data-analysis/gems/custom/rest-api) or the [Script gem](/data-analysis/gems/custom/script). Because these gems can contain arbitrary code, lineage information may not be available for columns processed within them.
