polars.SQLContext.register_many#

SQLContext.register_many(
frames: Mapping[str, DataFrame | LazyFrame] | None = None,
**named_frames: DataFrame | LazyFrame,
) Self[source]#

Register multiple eager/lazy frames as tables, using the associated names.

Parameters:
frames

A {name:frame, ...} mapping.

**named_frames

Named eager/lazy frames, provided as kwargs.

Examples

>>> lf1 = pl.LazyFrame({"a": [1, 2, 3], "b": ["m", "n", "o"]})
>>> lf2 = pl.LazyFrame({"a": [2, 3, 4], "c": ["p", "q", "r"]})
>>> lf3 = pl.LazyFrame({"a": [3, 4, 5], "b": ["s", "t", "u"]})
>>> lf4 = pl.LazyFrame({"a": [4, 5, 6], "c": ["v", "w", "x"]})

Register multiple frames at once, either by passing in as a dict…

>>> ctx = pl.SQLContext().register_many({"tbl1": lf1, "tbl2": lf2})
>>> ctx.tables()
['tbl1', 'tbl2']

…or using keyword args:

>>> ctx.register_many(tbl3=lf3, tbl4=lf4).tables()
['tbl1', 'tbl2', 'tbl3', 'tbl4']