Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Called when a query is started.
Syntax
onQueryStarted(event)
Parameters
| Parameter | Type | Description |
|---|---|---|
event |
QueryStartedEvent | The event object containing information about the started query. |
Returns
None
Notes
This method is called synchronously with DataStreamWriter.start(). That is, onQueryStarted is called on all listeners before DataStreamWriter.start() returns the corresponding StreamingQuery. Do not block this method as it will block your query.
Examples
from pyspark.sql.streaming import StreamingQueryListener
class MyListener(StreamingQueryListener):
def onQueryStarted(self, event):
print(f"Query started: {event.id}")
def onQueryProgress(self, event):
pass
def onQueryIdle(self, event):
pass
def onQueryTerminated(self, event):
pass
spark.streams.addListener(MyListener())