---
title: dropTempView
description: "Catalog.dropTempView method in PySpark: 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."
canonical_url: https://docs.databricks.com/aws/en/pyspark/reference/classes/catalog/dropTempView
---

# dropTempView

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.

## Syntax

```
dropTempView(viewName: str)
```

## Parameters

| Parameter  | Type | Description                         |
| ---------- | ---- | ----------------------------------- |
| `viewName` | str  | Name of the temporary view to drop. |

## Returns

`bool`

If the temporary view was successfully dropped or not.

## Examples

```python
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 exist.
spark.table("my_table")
# Traceback (most recent call last):
#     ...
# AnalysisException: ...
```
