pyspark.sql.SparkSession.catalog#

property SparkSession.catalog#

Interface through which the user may create, drop, alter or query underlying databases, tables, functions, etc.

New in version 2.0.0.

Changed in version 3.4.0: Supports Spark Connect.

Returns
Catalog

Examples

>>> spark.catalog
<...Catalog object ...>

Create a temp view, show the list, and drop it.

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