pyspark.sql.streaming.StreamingQueryManager.active#

property StreamingQueryManager.active#

Returns a list of active queries associated with this SparkSession

New in version 2.0.0.

Changed in version 3.5.0: Supports Spark Connect.

Returns
list

The active queries associated with this SparkSession.

Examples

>>> sdf = spark.readStream.format("rate").load()
>>> sdf.printSchema()
root
  |-- timestamp: timestamp (nullable = true)
  |-- value: long (nullable = true)
>>> sq = sdf.writeStream.format('memory').queryName('this_query').start()
>>> sqm = spark.streams

Get the list of active streaming queries

>>> [q.name for q in sqm.active]
['this_query']
>>> sq.stop()