Docs
Docs /SQL Editor /Column lineage
SQL EditorPrism Insights

Column lineage

A graph of where each output column comes from (through CTEs, joins, UNNEST, views, and pipe stages), built from the SQL as you type. Use it to answer "which table does this number actually come from" without reading the query backwards.

Query 1
123456789101112
WITH vehicle_data AS (
SELECT vehicle_sk, make, model, colour, fuel_type
FROM `ace-analytics.warehouse.dim_vehicle`
),
make_stats AS (
SELECT make, COUNT(*) AS vehicle_count, COUNT(DISTINCT model) AS model_count
FROM vehicle_data
GROUP BY make
)
SELECT v.vehicle_sk, v.make, v.model, v.colour, s.vehicle_count, s.model_count
FROM vehicle_data v
JOIN make_stats s USING (make)
Prism Insights → Lineage

TABLE

dim_vehicle

vehicle_sk

make

model

colour

fuel_type

CTE

vehicle_data

vehicle_sk

make

model

colour

fuel_type

CTE

make_stats

vehicle_count

model_count

OUT

<output>

vehicle_sk

make

model

colour

vehicle_count

model_count

Hovering model_count in the output lights up everything upstream of it: make_stats.model_count, vehicle_data.model, and dim_vehicle.model. Solid edges are direct inputs; dashed edges are side inputs such as the GROUP BY key.

Opening it

Open the Prism Insights panel (header ⋮ → Prism Insights, or right-click the editor → Show Prism Insights) and choose Lineage: a tab when the panel is wide, a dropdown entry when it’s narrow.

  • A project is connected; lineage needs the schema to resolve SELECT * and unqualified columns. Without one the view says Connect to a project to enable lineage analysis.

  • The SQL parses. A partial or broken query shows Could not analyze lineage for this query.

Nothing has to run. The graph is rebuilt from the editor text as you type, so it doubles as a check on a query you haven’t executed yet. In a multi-statement script it follows the statement selected in the results bar.

Reading the graph

Each box is an object; the badge names its kind:

BadgeObject
TABLE, VIEWA source. Views are expanded, so their own sources appear behind them
CTEA WITH entry
SUB, DTA subquery in WHERE / SELECT, a derived table in FROM
TVF, UNNEST, PIVOT, UNPIVOTA table function, an array unnest, a pivot
OUT, DMLThe final output; the target of an INSERT, UPDATE, MERGE

Edges run left to right from source columns to the columns computed from them. A solid edge is a direct input (v.modelmodel); a dashed edge is a side input (a GROUP BY key, a join condition, a WHERE column) that shaped the value without being copied into it.

The bar above the graph counts what’s in it: 1 table, 2 CTEs · 32 columns · 47 edges. If part of the query couldn’t be resolved it adds Partial result (n errors) and draws what it could.

Moving around the graph

  • Hover a column to highlight it with everything upstream and downstream; other edges fade.
  • Scroll to zoom, centered on the pointer.
  • Drag the background to pan.
  • Drag a box to move it; edges follow.
  • Click the 81% badge (bottom right) to toggle between fit-to-width and 100%.

Switching to the table view

Graph | Table at the right of the summary bar switches to a table with one row per output column: Output, Type, Source, Transformation, Used In. It’s the form to copy into a ticket or a data-catalog entry, and the easier one to scan when a query has more than a few dozen columns.