列表表格

回傳指定資料庫中的資料表/檢視清單。

語法

listTables(dbName: str = None, pattern: str = None)

參數

參數 類型 說明
dbName 力量,選用 資料庫名稱以列出表格。 可以用目錄名稱來限定。
pattern 力量,選用 表格名稱需要相符的圖案。

退貨

list 的 Table

Notes

若未指定資料庫,則使用目前的資料庫與目錄。 此 API 包含所有暫存檢視。

Examples

spark.range(1).createTempView("test_view")
spark.catalog.listTables()
# [Table(name='test_view', catalog=None, namespace=[], description=None, ...

spark.catalog.listTables(pattern="test*")
# [Table(name='test_view', catalog=None, namespace=[], description=None, ...

spark.catalog.listTables(pattern="table*")
# []

_ = spark.catalog.dropTempView("test_view")
spark.catalog.listTables()
# []