pyspark.sql.streaming.StreamingQueryListener¶
-
class
pyspark.sql.streaming.
StreamingQueryListener
¶ Interface for listening to events related to
StreamingQuery
.Notes
The methods are not thread-safe as they may be called from different threads. The events received are identical with Scala API. Refer to its documentation.
This API is evolving.
Examples
>>> class MyListener(StreamingQueryListener): ... def onQueryStarted(self, event: QueryStartedEvent) -> None: ... # Do something with event. ... pass ... ... def onQueryProgress(self, event: QueryProgressEvent) -> None: ... # Do something with event. ... pass ... ... def onQueryTerminated(self, event: QueryTerminatedEvent) -> None: ... # Do something with event. ... pass ... >>> spark.streams.addListener(MyListener())
Methods
onQueryProgress
(event)Called when there is some status update (ingestion rate updated, etc.)
onQueryStarted
(event)Called when a query is started.
onQueryTerminated
(event)Called when a query is stopped, with or without error.