options (DataStreamReader)
Adds multiple input options for the underlying data source.
Syntax
options(**options)
Parameters
Parameter | Type | Description |
|---|---|---|
| dict | Key-value pairs of options. |
Returns
DataStreamReader
Examples
Python
spark.readStream.options(x="1", y=2)
# <...streaming.readwriter.DataStreamReader object ...>
Specify options as a dictionary:
Python
spark.readStream.options(**{"k1": "v1", "k2": "v2"})
# <...streaming.readwriter.DataStreamReader object ...>
Generate 10 rows per second with 10 partitions using the Rate source:
Python
import time
q = spark.readStream.format("rate").options(
rowsPerSecond=10, numPartitions=10
).load().writeStream.format("console").start()
time.sleep(3)
q.stop()