---
title: writeStream
description: "DataFrame.writeStream property in PySpark: Interface for saving the content of the streaming DataFrame out into external storage."
canonical_url: https://docs.databricks.com/aws/en/pyspark/reference/classes/dataframe/writeStream
---

# writeStream

Interface for saving the content of the streaming `DataFrame` out into external storage.

## Returns

`DataStreamWriter`

## Examples

```python
import time
import tempfile
df = spark.readStream.format("rate").load()
type(df.writeStream)
# <class '...streaming.readwriter.DataStreamWriter'>

with tempfile.TemporaryDirectory(prefix="writeStream") as d:
    query = df.writeStream.toTable("my_table", checkpointLocation=d)
    time.sleep(3)
    query.stop()
```
