polars(options)
Run a Polars SQL query or a Python script over lake tables. Provide exactly one of query or script. If the API rejects the run, the SDK raises instead of returning a failed result.
Query mode
Query mode requires at least one table binding, either as"namespace.table" (the alias defaults to the table name) or as PolarsTable(alias=..., table=...).
Script mode
Pass a Python script that uses Polars. Useparams to inject values, and destination/save_mode to persist the result as a lake table.
Distributed runs
Passdistributed=True with a destination to run on Polars Cloud.
Parameters
Polars SQL query. Provide exactly one of
query or script.Python script source using Polars. Provide exactly one of
query or script.Table bindings. Required (at least one) in query mode.
Parameters made available to the script.
Run on Polars Cloud. Requires
destination.Catalog to resolve tables against.
Instance type for distributed runs.
Cluster size for distributed runs, from 1 to 64.
vCPUs per instance, from 1 to 32.
Lake table to write results to. Required when
distributed=True.overwrite or append. Applies when writing to destination.Polars runs execute compute synchronously and can take minutes when a sandbox cold-starts or a distributed cluster spins up. The SDK uses an extended request timeout of 30 minutes for Polars runs.
Return type: PolarsResult
| Field | Type | Description |
|---|---|---|
success | bool | Whether the run executed successfully |
results | Optional[QueryResultColumns] | Results with columns, column_types, and rows |
row_count | Optional[int] | Number of rows returned |
execution_time | Optional[str] | Run execution time |
saved | Optional[PolarsSaved] | table, rows_written, and mode when results were persisted |
compute | Optional[PolarsCompute] | mode, distributed, instance_type, cluster_size |