polars.SQLContext.register#

SQLContext.register(name: str, frame: DataFrame | LazyFrame) Self[source]#

Register a single frame as a table, using the given name.

Parameters:
name

Name of the table.

frame

eager/lazy frame to associate with this table name.

Examples

>>> df = pl.DataFrame({"hello": ["world"]})
>>> ctx = pl.SQLContext()
>>> ctx.register("frame_data", df).execute("SELECT * FROM frame_data").collect()
shape: (1, 1)
┌───────┐
│ hello │
│ ---   │
│ str   │
╞═══════╡
│ world │
└───────┘