outputMode (DataStreamWriter)
Specifies how data of a streaming DataFrame is written to a streaming sink.
Syntax
outputMode(outputMode)
Parameters
Parameter | Type | Description |
|---|---|---|
| str | Output mode. Options are |
Returns
DataStreamWriter
Examples
Python
df = spark.readStream.format("rate").load()
df.writeStream.outputMode('append')
# <...streaming.readwriter.DataStreamWriter object ...>
Use complete mode to print aggregated counts:
Python
import time
df = spark.readStream.format("rate").option("rowsPerSecond", 10).load()
df = df.groupby().count()
q = df.writeStream.outputMode("complete").format("console").start()
time.sleep(3)
q.stop()