QueryResult#

class polars_cloud.QueryResult(result: QueryInfo, status: QueryStatus)

The result of a Polars Cloud query.

Attributes:

head

The first n rows of the result.

n_rows_total

Total rows that are outputted by the result.

failed_stages

Total failed stages.

finished_stages

Total executed stages.

location

Location where the result is written.

file_type

The file type where the result is written to.

Methods:

graph

Return the query plan as dot diagram.

plan

Return the executed plan in string format.

lazy

Convert the QueryResult into a LazyFrame.

property head: DataFrame | None

The first n rows of the result.

property n_rows_total: int | None

Total rows that are outputted by the result.

property failed_stages: int

Total failed stages.

property finished_stages: int

Total executed stages.

This can be more than total stages, as failed stages can be rescheduled.

property location: list[str] | None

Location where the result is written.

property file_type: FileType

The file type where the result is written to.

graph(
*,
show: bool = True,
output_path: str | Path | None = None,
raw_output: bool = False,
figsize: tuple[float, float] = (16.0, 12.0),
) str | None

Return the query plan as dot diagram.

Parameters:
show

Show the figure.

output_path

Write the figure to disk.

raw_output

Return dot syntax. This cannot be combined with show and/or output_path.

figsize

Passed to matplotlib if show == True.

plan(plan_type: PlanType = 'physical') str

Return the executed plan in string format.

Parameters:
plan_type: {‘physical’, ‘ir’}

Plan visualization to return.

  • physical: The executed physical plan/stages.

  • ir: The optimized query plan before execution.

lazy() LazyFrame

Convert the QueryResult into a LazyFrame.