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
str
Polars SQL query. Provide exactly one of
query or script.str
Python script source using Polars. Provide exactly one of
query or script.list[str | PolarsTable]
default:"[]"
Table bindings. Required (at least one) in query mode.
dict[str, Any]
default:"{}"
Parameters made available to the script.
bool
default:"False"
Run on Polars Cloud. Requires
destination.str
Catalog to resolve tables against.
str
Instance type for distributed runs.
int
Cluster size for distributed runs, from 1 to 64.
int
vCPUs per instance, from 1 to 32.
str
Lake table to write results to. Required when
distributed=True.str
default:"overwrite"
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.