def active(self): """Returns a list of active queries associated with this SQLContext >>> 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] [u'this_query'] >>> sq.stop() """ return [StreamingQuery(jsq) for jsq in self._jsqm.active()]
def get(self, id): """Returns an active query from this SQLContext or throws exception if an active query with this name doesn't exist. >>> sq = sdf.writeStream.format('memory').queryName('this_query').start() >>> sq.name u'this_query' >>> sq = spark.streams.get(sq.id) >>> sq.isActive True >>> sq = sqlContext.streams.get(sq.id) >>> sq.isActive True >>> sq.stop() """ return StreamingQuery(self._jsqm.get(id))
def get(self, id): """Returns an active query from this SQLContext or throws exception if an active query with this name doesn't exist. >>> sq = sdf.writeStream.format('memory').queryName('this_query').start() >>> sq.name u'this_query' >>> sq = spark.streams.get(sq.id) >>> sq.isActive True >>> sq = sqlContext.streams.get(sq.id) >>> sq.isActive True >>> sq.stop() """ if not isinstance(id, intlike): raise ValueError("The id for the query must be an integer. Got: %s" % id) return StreamingQuery(self._jsqm.get(id))
def _sq(self, jsq): from pyspark.sql.streaming import StreamingQuery return StreamingQuery(jsq)