polars.LazyFrame.remote#
- LazyFrame.remote(
- context: pc.ComputeContext | None = None,
- plan_type: pc._typing.PlanTypePreference = 'dot',
Run a query remotely on Polars Cloud.
This allows you to run Polars remotely on one or more workers via several strategies for distributed compute.
Read more in the Announcement post
- Parameters:
- context
Compute context in which queries are executed. If none given, it will take the default context.
- plan_type
Whether to give a dot diagram of a plain text version of logical plan.
Examples
Run a query on a cloud instance.
>>> lf = pl.LazyFrame([1, 2, 3]).sum() >>> in_progress = lf.remote().collect() >>> # do some other work >>> in_progress.await_result() shape: (1, 1) ┌──────────┐ │ column_0 │ │ --- │ │ i64 │ ╞══════════╡ │ 6 │ └──────────┘
Run a query distributed.
>>> lf = ( ... pl.scan_parquet("s3://my_bucket/").group_by("key").agg(pl.sum("values")) ... ) >>> in_progress = lf.remote().distributed().collect() >>> in_progress.await_result() shape: (1, 1) ┌──────────┐ │ column_0 │ │ --- │ │ i64 │ ╞══════════╡ │ 6 │ └──────────┘