データ フレームの内容をデータ ソースにストリーミングし、StreamingQuery オブジェクトを返します。
構文
start(path=None, format=None, outputMode=None, partitionBy=None, queryName=None, **options)
パラメーター
| パラメーター | タイプ | 説明 |
|---|---|---|
path |
str、省略可能 | Hadoop でサポートされているファイル システムのパス。 |
format |
str、省略可能 | 保存に使用する形式。 |
outputMode |
str、省略可能 | シンクにデータを書き込む方法: append、 complete、または update。 |
partitionBy |
str または list、省略可能 | パーティション分割列の名前。 |
queryName |
str、省略可能 | クエリの一意の名前。 |
**options |
その他のすべての文字列オプション。 ほとんどのストリームに checkpointLocation を提供します。 memory ストリームには必要ありません。 |
返品
StreamingQuery
例示
df = spark.readStream.format("rate").load()
基本的な例:
q = df.writeStream.format('memory').queryName('this_query').start()
q.isActive
# True
q.name
# 'this_query'
q.stop()
q.isActive
# False
トリガーと追加のパラメーターを使用する場合:
q = df.writeStream.trigger(processingTime='5 seconds').start(
queryName='that_query', outputMode="append", format='memory')
q.name
# 'that_query'
q.isActive
# True
q.stop()