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().
Arguments
- nodes
The output of
extract_lineage(), or a list of nodes created withcreate_table_node().- edges
A list of edges created with
create_column_edge(). Ignored whennodesis anextract_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
NULLso 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()