Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Returns a list of tables/views in the specified database.
Syntax
listTables(dbName: str = None, pattern: str = None)
Parameters
| Parameter | Type | Description |
|---|---|---|
dbName |
str, optional | Name of the database to list the tables. Can be qualified with catalog name. |
pattern |
str, optional | The pattern that the table name needs to match. |
Returns
list of Table
Notes
If no database is specified, the current database and catalog are used. This API includes all temporary views.
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()
# []