Document Data Lineage
Purpose
Show, verifiably, how a dataset or metric is produced from its sources, so people can trust it, trace errors to their origin and assess the impact of changes before they break consumers.
When to use
- A reported figure is questioned and its derivation must be explained.
- A source, table or column is about to change and downstream impact is needed.
- Audit or regulation requires traceability of reported data (e.g. financial or risk reporting).
When not to use
- Detailed column-by-column load specification for building a pipeline. Use
source-to-target-mapping. - A discovery-oriented summary of one dataset. Use
data-catalog-entry. - Impact of a business or system change beyond data flows. Use
impact-analysis.
Inputs
Required:
- The lineage target (a dataset, column, metric or report) and any available evidence: SQL/transformation code, pipeline definitions, job lists, architecture notes or people's descriptions.
Optional:
- Scope direction (upstream, downstream, both), depth, owners, schedules, known issues, sensitivity of the data.
If there is no evidence at all, ask for code, pipeline names or a person who knows the flow; lineage reconstructed from guesses is worse than none.
Process
- Fix the target and direction: upstream (where does it come from), downstream (who uses it) or both, and the granularity (dataset-level, plus column-level for critical elements).
- Walk the flow hop by hop from evidence: source system and object, extraction method, landing/raw layer, each transformation step, serving layer, consumer (report, model, export, API).
- For each hop record: node name, layer, owner, run schedule, and the transformation type (pass-through, filter, join, aggregate, derive, lookup, deduplicate, manual adjustment).
- For critical columns, write the derivation as a formula or pseudo-SQL, including filters, join keys, currency/unit conversions and hard-coded values.
- Mark each hop's verification status: verified from code, verified from system metadata, stated by a person, or
[INFERRED]. Never present inferred hops as verified. - Flag breaks and risks: manual steps (spreadsheets, uploads), undocumented logic, multiple competing sources of the same fact, fan-out points where one change hits many consumers.
- Note control points: where data quality checks, reconciliations or approvals happen along the path.
- Note sensitive data movement: where personal data enters, is masked, or leaves the controlled environment.
- Draw the flow as a diagram-as-code block (left-to-right) and pair it with a hop table.
- List gaps, open questions and the people who could close them. If the goal continues, suggest
impact-analysisfor a planned change,data-quality-rulesfor unguarded hops, ordata-catalog-entryto publish the result.
Output format
# Data Lineage: <target>
Direction: <upstream/downstream/both> | Granularity: <dataset / column> | As of: <date> | Author: <...>
## Diagram
<diagram-as-code, source → ... → consumer>
## Hops
| # | From | To | Layer | Transformation | Logic (critical columns) | Owner | Schedule | Verified by |
|---|---|---|---|---|---|---|---|---|
## Control Points
- <check / reconciliation / approval at hop #>
## Risks and Breaks
- <manual step, competing source, fan-out>
## Gaps and Open Questions
- [INFERRED] ... — confirm with <role>
Quality checklist
- Every hop cites its evidence type; inferred hops are labeled
[INFERRED]. - Critical columns have explicit derivation logic including filters and conversions.
- Manual steps and competing sources are flagged, not smoothed over.
- Personal data movement and masking points are shown.
- Diagram and hop table agree.
- All checks pass; if any fails, revise the output and re-run this checklist before answering.
Common pitfalls
- Stopping at the warehouse. The spreadsheet adjustment between the warehouse and the board pack is often where numbers diverge.
- Table-level lineage only. "Revenue comes from orders" hides the filter that excludes returns.
- Treating tool-harvested lineage as complete; dynamic SQL, stored procedures and manual uploads are commonly missed.
Example
Input: "Where does 'net revenue' on the finance dashboard come from? Here is the dashboard query and the mart SQL."
Excerpt of output:
- Hop 3: stg_orders → fct_revenue, aggregate daily; net_revenue = sum(gross_amount − discount − refund) where status <> 'cancelled', converted to EUR at daily rate. Verified from code.
- Hop 5: fct_revenue → finance dashboard, filter region ≠ 'internal'. Verified from code.
- Hop 1: ERP → landing, nightly extract
[INFERRED from job name]— confirm with ERP integration owner.