pyspark.sql.Catalog.dropTempView

Catalog.dropTempView(viewName: str) → None

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.

Notes

The return type of this method was None in Spark 2.0, but changed to Boolean in Spark 2.1.

Examples

>>> spark.createDataFrame([(1, 1)]).createTempView("my_table")
>>> spark.table("my_table").collect()
[Row(_1=1, _2=1)]
>>> spark.catalog.dropTempView("my_table")
True
>>> spark.table("my_table") 
Traceback (most recent call last):
    ...
AnalysisException: ...