Spec-Zone.ru › Polars

polars.SQLContext.tables

SQLContext.tables() → list[str]

Возвращает список зарегистрированных имён таблиц.

Примечания

Метод tables() возвращает те же значения, что и SQL-оператор «SHOW TABLES», но в виде списка, а не фрейма.

Выполнение в виде 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 │
└─────────────┘

Вызов метода:

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

Примеры

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