Sink¶
write_target.type: sink. sink_type selects the destination. Every sink emits
dp.create_sink(name=, format=, options=) plus one
@dp.append_flow(target=<sink_name>, name="f_<sink_name>_<index>",
comment=) per source view, reading the source with
spark.readStream.table(...).
Minimal example¶
Add this entry to the actions list in your flowgroup.
- name: write_orders_to_delta_sink
type: write
source: v_orders
write_target:
type: sink
sink_type: delta
sink_name: orders_delta_sink
options:
tableName: "${catalog}.${gold_schema}.orders_export"
Options¶
Key |
Type |
Default |
Notes |
|---|---|---|---|
|
string |
required |
|
|
string |
— |
Unique sink identifier; used in the emitted flow names. |
|
dict |
|
Sink options. |
|
string |
derived |
— |
sink_type-specific fields¶
sink_type |
Additional fields |
Notes |
|---|---|---|
|
|
Format fixed |
|
|
Format fixed |
|
|
No separate |
|
|
Exactly one of |
|
|
Writes through a user-supplied PySpark |
- name: write_orders_to_kafka_sink
type: write
source: v_orders_for_kafka
write_target:
type: sink
sink_type: kafka
sink_name: order_events_kafka
bootstrap_servers: "${kafka_bootstrap_cluster}"
topic: "acme.orders.fulfillment"
options:
kafka.security.protocol: "SASL_SSL"
kafka.sasl.mechanism: "PLAIN"
- name: write_orders_to_eventhubs
type: write
source: v_orders_for_eventhubs
write_target:
type: sink
sink_type: kafka
sink_name: order_events_eventhubs
bootstrap_servers: "${eh_namespace}.servicebus.windows.net:9093"
topic: "acme-orders"
options:
kafka.security.protocol: "SASL_SSL"
kafka.sasl.mechanism: "OAUTHBEARER"
- name: merge_customer_updates
type: write
source: v_customer_changes
write_target:
type: sink
sink_type: foreachbatch
sink_name: customer_merge_sink
batch_handler: |
df.createOrReplaceTempView("batch_view")
df.sparkSession.sql("MERGE INTO ${catalog}.${gold_schema}.dim_customer ...")
- name: write_to_custom_sink
type: write
source: v_seed_rows
write_target:
type: sink
sink_type: custom
sink_name: backed_sink
module_path: "py_functions/custom_sink.py"
custom_sink_class: "MyCustomSink"
options:
output_path: "/tmp/custom_sink_output"
Action fields¶
These fields sit on the action, alongside write_target.
Field |
Type |
Default |
Requirement and behaviour |
|---|---|---|---|
|
string |
required |
Action name, unique within the flowgroup. |
|
string |
required |
Always |
|
string / list |
conditional |
Input view(s). Standard streaming writes and most sinks accept a list. CDC, replace, replace_where and foreachbatch use one view. Snapshot CDC takes its source inside |
|
mapping |
required |
Target settings; |
|
string |
derived |
Comment/docstring for the generated flow or view. |
|
string |
|
|
|
bool |
|
Emits |
|
bool / list |
— |
Accepted on the model; writes do not add metadata columns. Select columns on load or supported transform actions instead. |
|
list[string] |
— |
Extra upstream table/view references. See Dependency analysis reference. |