StreamingQuery
A handle to a query that is executing continuously in the background as new data arrives. All methods are thread-safe.
Syntax
# Returned by DataStreamWriter.start() or DataStreamWriter.toTable()
q = df.writeStream.format("console").start()
Properties
Property | Description |
|---|---|
Returns the unique ID of this query that persists across restarts from checkpoint data. | |
Returns the unique ID of this query that does not persist across restarts. | |
Returns the user-specified name of the query, or | |
Returns whether this streaming query is currently active. | |
Returns the current status of the query as a dict. | |
Returns an array of the most recent | |
Returns the most recent |
Methods
Method | Description |
|---|---|
Waits for the termination of this query, either by | |
Blocks until all available data in the source has been processed and committed to the sink. Intended for testing. | |
Stops this streaming query. | |
Prints the (logical and physical) plans to the console for debugging. | |
Returns the |
Examples
sdf = spark.readStream.format("rate").load()
sq = sdf.writeStream.format('memory').queryName('this_query').start()
sq.isActive
# True
sq.name
# 'this_query'
sq.awaitTermination(5)
# False
sq.stop()
sq.isActive
# False