DirectQuery#

class polars_cloud.DirectQuery(query_id: UUID, client: pcr.SchedulerClient)

A Polars Cloud direct connect query.

Note

This object is returned when spawning a new query on a compute cluster running in direct connect mode. It should not be instantiated directly by the user.

Examples

>>> ctx = pc.ComputeContext(connection_mode="direct")
>>> query = lf.remote(ctx).sink_parquet(...)
>>> type(query)
<class 'polars_cloud.query.query.DirectQuery'>

Methods:

get_status

Get the current status of the query.

await_result_async

Await the result of the query asynchronously and return the result.

await_result

Block the current thread until the query is processed and get a result.

await_progress_async

Await progress for the ongoing query asynchronously.

await_progress

Block the thread and wait until progress is made on the query.

cancel

Cancel the execution of the query.

graph

Return the query plan as dot diagram.

plan

Return the executed plan in string format.

get_status() QueryStatus

Get the current status of the query.

async await_result_async(
*,
raise_on_failure: bool = True,
) QueryResult

Await the result of the query asynchronously and return the result.

await_result(
*,
raise_on_failure: bool = True,
) QueryResult

Block the current thread until the query is processed and get a result.

async await_progress_async() QueryProgress

Await progress for the ongoing query asynchronously.

await_progress() QueryProgress

Block the thread and wait until progress is made on the query.

cancel() None

Cancel the execution of the query.

graph(
plan_type: PlanType = 'physical',
*,
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:
plan_type: {‘physical’, ‘ir’}

Plan visualization to return.

  • physical: The executed physical plan/stages.

  • ir: The optimized query plan before execution.

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.