Skip to content

Return the compute graph of a Python Polars LazyFrame as DOT

Returns the polars query plan as a graph in DOT language (via LazyFrame$show_graph()), useful for inspecting how expressions get materialized and for profiling efficiency. The returned DOT source can be rendered directly (e.g. with the graphviz CLI); no graphviz Python package is required.

show_lazy_graph(
lf_py,
optimized = TRUE,
engine = "streaming",
plan_stage = "physical",
render = FALSE
)
Argument Description
lf_py A Python Polars LazyFrame.
optimized Logical; whether to apply the query optimizer. Default TRUE.
engine Engine used to process the query. Default "streaming".
plan_stage Plan stage to display: "physical" (default) or "ir".
render Logical; if TRUE, render the graph with DiagrammeR::grViz() and return the htmlwidget. Requires the DiagrammeR package (Suggests). Default FALSE.

The query plan as a single character string in DOT language, or an htmlwidget if render = TRUE.