DirectQuery#
- class polars_cloud.DirectQuery(
- query_id: UUID,
- client: pcr.SchedulerClient,
- cluster: ComputeContext | ClientContext,
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_statusGet the current status of the query.
get_profileGet the current profile of the query if available.
await_result_asyncAwait the result of the query asynchronously and return the result.
await_resultBlock the current thread until the query is processed and get a result.
await_profile_asyncWait for an update to the query profile asynchronously.
await_profileBlock the thread and wait until the query profile is updated.
cancelCancel the execution of the query.
graphReturn the query plan as dot diagram.
planReturn the executed plan in string format.
- get_status() QueryStatus
Get the current status of the query.
- get_profile() QueryProfile | None
Get the current profile of the query if available.
- async await_result_async(
- *,
- raise_on_failure: bool = True,
Await the result of the query asynchronously and return the result.
- await_result(
- *,
- raise_on_failure: bool = True,
Block the current thread until the query is processed and get a result.
- async await_profile_async() QueryProfile
Wait for an update to the query profile asynchronously.
- await_profile() QueryProfile
Block the thread and wait until the query profile is updated.
- 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),
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
showand/oroutput_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.