Skip to contents

Draws a lineage graph with React Flow: tables as draggable nodes, column-to-column edges, and zoom/pan controls. Pass the result of extract_lineage() directly (it is detected automatically, so piping works), or build nodes and edges yourself with create_table_node() and create_column_edge().

Usage

lineage_flow(
  nodes = list(),
  edges = list(),
  width = NULL,
  height = NULL,
  elementId = NULL
)

Arguments

nodes

The output of extract_lineage(), or a list of nodes created with create_table_node().

edges

A list of edges created with create_column_edge(). Ignored when nodes is an extract_lineage() result, which carries its own edges.

width, height

CSS dimensions of the widget, e.g. "100%" or "600px". Default to full width and 600px tall.

elementId

Explicit HTML element id for the widget. Usually left NULL so one is generated.

Value

An htmlwidget that prints in the RStudio viewer, R Markdown / Quarto documents, and Shiny apps.

See also

extract_lineage() to compute lineage automatically; lineage_flowOutput() and renderLineageFlow() for Shiny.

Examples

# Build a small diagram by hand
nodes <- list(
  create_table_node("orders", c("order_id", "amount"), x = 0, y = 0),
  create_table_node("daily_totals", c("total"),
    x = 400, y = 0, table_type = "target"
  )
)
edges <- list(
  create_column_edge("orders", "amount", "daily_totals", "total",
    label = "SUM()", animated = TRUE
  )
)
lineage_flow(nodes, edges)
# Or pipe from extract_lineage() extract_lineage("SELECT id, name FROM customers") |> lineage_flow()