Skip to content

Lineage

Table-level and column-level lineage with upstream, downstream, and bidirectional modes, plus export to tree, JSON, DOT, and Mermaid.

Run lineage

codeweb lineage <TARGET> computes how data reaches — and leaves — a table or column:

codeweb lineage "orders"                                   # table-level
codeweb lineage "orders.status"                            # column-level
codeweb lineage "public.orders.status"                     # schema-qualified column
codeweb lineage "table:public.orders"                      # node-key grammar, same as trace/detail

Options:

codeweb lineage "orders" --direction upstream    # who writes/defines it
codeweb lineage "orders" --direction downstream  # who consumes it
codeweb lineage "orders" --depth 5               # recursion depth (default 5)
codeweb lineage "orders" --flow-only             # hide reference-only sources

--direction accepts upstream, downstream, or both (default).

Output formats

codeweb lineage "orders" --format json      # machine-readable
codeweb lineage "orders" --format dot > lineage.dot
codeweb lineage "orders" --format mermaid   # markdown-embeddable

--format dot and --format mermaid export the entity subgraph. The default --format tree supports four renderings via --view:

ViewRendering
tree (default)Indented lineage tree
entityEntities only, no processes
relationExplicit source──process──▶target lines
groupedBranches grouped by connecting process

Tune flow detection

With --flow-only, codeweb hides sources that only reference a table without moving data. The thresholds live in codeweb.toml:

[lineage]
# minimum column overlap and ratio for a flow edge to count

The [lineage] section exposes flow thresholds (flow_min_overlap, flow_min_ratio defaults apply unless overridden).

Column-level analysis

Lineage answers “where does this column come from”. For the inverse question — “which filters, joins, and mappings does a procedure apply to its tables” — use the column analysis commands codeweb columns and codeweb predicates. The HTTP equivalent is GET /api/v1/lineage; the MCP equivalent is codeweb_lineage.