|
1 | | -# SinkWrite |
| 1 | +--- |
| 2 | +title: SinkWrite |
| 3 | +--- |
2 | 4 |
|
3 | | -`SinkWrite` is...FIXME |
| 5 | +# SinkWrite Flow Execution |
| 6 | + |
| 7 | +`SinkWrite` is a [StreamingFlowExecution](StreamingFlowExecution.md) that writes a streaming `DataFrame` to a [Sink](#destination). |
| 8 | + |
| 9 | +`SinkWrite` represents a [StreamingFlow](StreamingFlow.md) with a [Sink](Sink.md) as the [output destination](ResolutionCompletedFlow.md#destinationIdentifier) at execution. |
| 10 | + |
| 11 | +When [executed](#startStream), `SinkWrite` starts a streaming query to append new rows to an [output table](#destination). |
| 12 | + |
| 13 | +## Creating Instance |
| 14 | + |
| 15 | +`SinkWrite` takes the following to be created: |
| 16 | + |
| 17 | +* <span id="identifier"> [TableIdentifier](FlowExecution.md#identifier) |
| 18 | +* <span id="flow"> [ResolvedFlow](StreamingFlowExecution.md#flow) |
| 19 | +* <span id="graph"> [DataflowGraph](DataflowGraph.md) |
| 20 | +* <span id="updateContext"> [PipelineUpdateContext](FlowExecution.md#updateContext) |
| 21 | +* <span id="checkpointPath"> [Checkpoint Location](StreamingFlowExecution.md#checkpointPath) |
| 22 | +* <span id="trigger"> [Streaming Trigger](StreamingFlowExecution.md#trigger) |
| 23 | +* <span id="destination"> [Destination](FlowExecution.md#destination) ([Sink](Sink.md)) |
| 24 | +* <span id="sqlConf"> [SQL Configuration](StreamingFlowExecution.md#sqlConf) |
| 25 | + |
| 26 | +`SinkWrite` is created when: |
| 27 | + |
| 28 | +* `FlowPlanner` is requested to [plan a ResolvedFlow](FlowPlanner.md#plan) |
| 29 | + |
| 30 | +## Start Streaming Query { #startStream } |
| 31 | + |
| 32 | +??? note "StreamingFlowExecution" |
| 33 | + |
| 34 | + ```scala |
| 35 | + startStream(): StreamingQuery |
| 36 | + ``` |
| 37 | + |
| 38 | + `startStream` is part of the [StreamingFlowExecution](StreamingFlowExecution.md#startStream) abstraction. |
| 39 | + |
| 40 | +`startStream` builds the logical query plan of this [flow](#flow)'s structured query (requesting the [DataflowGraph](#graph) to [reanalyze](DataflowGraph.md#reanalyzeFlow) this [flow](#flow)). |
| 41 | + |
| 42 | +`startStream` creates a `DataStreamWriter` ([Spark Structured Streaming]({{ book.structured_streaming }}/DataStreamWriter/)) with the following: |
| 43 | + |
| 44 | +`DataStreamWriter`'s Property | Value |
| 45 | +-|- |
| 46 | + `queryName` | This [displayName](FlowExecution.md#displayName) |
| 47 | + `checkpointLocation` option | This [checkpoint path](#checkpointPath) |
| 48 | + `trigger` | This [streaming trigger](#trigger) |
| 49 | + `outputMode` | [Append]({{ book.structured_streaming }}/OutputMode/#append) (always) |
| 50 | + `format` | The [format](Sink.md#format) of this [output sink](#destination) |
| 51 | + `options` | The [options](Sink.md#options) of this [output sink](#destination) |
| 52 | + |
| 53 | +In the end, `startStream` starts the streaming write query to this [output table](#destination). |
0 commit comments