Spec-Zone.ru › Polars

polars.SQLContext.tables

SQLContext.tables() → list[str]

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']

© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/sql/api/polars.SQLContext.tables.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API