pyspark.sql.streaming.StreamingQueryManager.active

property StreamingQueryManager. active

返回与此 SparkSession 关联的活动查询列表

新增于版本 2.0.0。

版本 3.5.0 更改: 支持 Spark Connect。

Returns
list

与此 SparkSession 关联的活动查询。

示例

>>> 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

获取活跃的流查询列表

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