pyspark.sql.Catalog.dropTempView

Catalog.dropTempView(viewName: str) → bool[source]

Drops the local temporary view with the given view name in the catalog. If the view has been cached before, then it will also be uncached. Returns true if this view is dropped successfully, false otherwise.

New in version 2.0.0.

Parameters
viewNamestr

name of the temporary view to drop.

Returns
bool

If the temporary view was successfully dropped or not.

New in version 2.1.0: The return type of this method was None in Spark 2.0, but changed to bool in Spark 2.1.

Examples

>>> spark.createDataFrame([(1, 1)]).createTempView("my_table")

Dropping the temporary view.

>>> spark.catalog.dropTempView("my_table")
True

Throw an exception if the temporary view does not exists.

>>> spark.table("my_table")
Traceback (most recent call last):
    ...
AnalysisException: ...