polars.SQLContext.tables#

SQLContext.tables() list[str][source]#

Return a list of the registered table names.

Notes

The tables() method will return the same values as the “SHOW TABLES” SQL statement, but as a list instead of a frame.

Executing as SQL:

>>> frame_data = pl.DataFrame({"hello": ["world"]})
>>> ctx = pl.SQLContext(hello_world=frame_data)
>>> ctx.execute("SHOW TABLES", eager=True)
shape: (1, 1)
┌─────────────┐
│ name        │
│ ---         │
│ str         │
╞═════════════╡
│ hello_world │
└─────────────┘

Calling the method:

>>> ctx.tables()
['hello_world']

Examples

>>> df1 = pl.DataFrame({"hello": ["world"]})
>>> df2 = pl.DataFrame({"foo": ["bar", "baz"]})
>>> ctx = pl.SQLContext(hello_data=df1, foo_bar=df2)
>>> ctx.tables()
['foo_bar', 'hello_data']