Skip to content

Add Python bindings for accessing ExecutionMetrics #1379

@ShreyeshArangath

Description

@ShreyeshArangath

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

DataFusion Python currently provides execution metrics only through the explain(analyze=True) output, which displays metrics as formatted console text. There is no structured Python API to programmatically access per-operator metrics such as output_rows, elapsed_compute, spill_count, etc.

Describe the solution you'd like
Expose a structured Python API to access execution metrics after running a query
Describe alternatives you've considered
N/A

Additional context
This mirrors the existing Rust API in datafusion::physical_plan::metrics and makes it accessible from Python. The metrics would only be populated after execution, matching DataFusion's semantics where metrics are collected during query execution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions