Skip to content

Polars

filebadge

exportbadge

Introduced in v4.0

The Polars backend is experimental and is subject to backwards incompatible changes.

ibis.memtable Support memtable

The Polars backend supports memtables by natively executing queries against the underlying storage (e.g., pyarrow Tables or pandas DataFrames).

Install

Install ibis and dependencies for the Polars backend:

pip install 'ibis-framework[polars]'
conda install -c conda-forge ibis-polars
mamba install -c conda-forge ibis-polars

Connect

ibis.polars.connect

con = ibis.polars.connect()

ibis.polars.connect is a thin wrapper around ibis.backends.polars.Backend.do_connect.

Connection Parameters

do_connect(tables=None)

Construct a client from a dictionary of polars LazyFrames and/or DataFrames.

Parameters:

Name Type Description Default
tables MutableMapping[str, pl.LazyFrame | pl.DataFrame] | None

An optional mapping of string table names to polars LazyFrames.

None

File Support

read_csv(path, table_name=None, **kwargs)

Register a CSV file as a table in the current database.

Parameters:

Name Type Description Default
path str | Path

The data source. A string or Path to the CSV file.

required
table_name str | None

An optional name to use for the created table. This defaults to a sequentially generated name.

None
**kwargs Any

Additional keyword arguments passed to Polars loading function. See https://pola-rs.github.io/polars/py-polars/html/reference/api/polars.scan_csv.html for more information.

{}

read_parquet(path, table_name=None, **kwargs)

Register a parquet file as a table in the current database.

Parameters:

Name Type Description Default
path str | Path | Iterable[str]

The data source(s). May be a path to a file, an iterable of files, or directory of parquet files.

required
table_name str | None

An optional name to use for the created table. This defaults to a sequentially generated name.

None
**kwargs Any

Additional keyword arguments passed to Polars loading function. See https://pola-rs.github.io/polars/py-polars/html/reference/api/polars.scan_parquet.html for more information (if loading a single file or glob; when loading multiple files polars' scan_pyarrow_dataset method is used instead).

{}

read_delta(path, table_name=None, **kwargs)

Register a Delta Lake as a table in the current database.

Parameters:

Name Type Description Default
path str | Path

The data source(s). Path to a Delta Lake table directory.

required
table_name str | None

An optional name to use for the created table. This defaults to a sequentially generated name.

None
**kwargs Any

Additional keyword arguments passed to Polars loading function. See https://pola-rs.github.io/polars/py-polars/html/reference/api/polars.scan_delta.html for more information.

{}

Last update: August 1, 2023