On this page

Replace rows in a streaming table

mode: replace generates a Databricks REPLACE USING flow (@dp.replace_flow). For each replace_using key value present in a batch it replaces that key’s target rows with the batch’s rows for that key — a replace, not a merge. replace_using is a grouping key, not a unique primary key: one key may own many rows, and every row the source sends for it is kept (appended, never collapsed into one). This is the opposite of mode: cdc, which merges change events onto a unique key into a single row. sequence_by orders competing batches for a key (highest wins). It requires a replace_config block, forces create_table: true, and reads its source as a streaming query (readMode: batch is rejected). A REPLACE USING target must be served by this single flow — it cannot share its table with any other write action. Fields under write_target.replace_config:

Minimal example

Add this entry to the actions list in your flowgroup.

- name: write_orders_current
  type: write
  source: v_order_updates
  write_target:
    type: streaming_table
    mode: replace
    catalog: "${catalog}"
    schema: "${silver_schema}"
    table: orders_current
    replace_config:
      replace_using: ["order_id"]
      sequence_by: "updated_at"

Options

Key

Type

Default

Notes

replace_using

list[string]

required

Non-empty grouping-key columns whose rows a batch replaces; need not be unique (many rows per key are kept). Emitted as replace_using=.

sequence_by

string

required

Exactly one ordering column (highest value wins); emitted as sequence_by=. Unlike cdc_config, a list is not allowed.

Note

The batch-read sibling is mode: replace_where: a replace_where_config predicate for Databricks’ REPLACE WHERE flow, mirroring cdc → snapshot_cdc, split by streaming vs batch source read. See Replace rows matching a predicate.

Shared table and view fields

These write_target fields apply to streaming_table and materialized_view. Sinks use their own field set.

Key

Type

Default

Notes

type

string

required

streaming_table, materialized_view, or sink.

catalog

string

—

UC catalog.

schema

string

—

UC namespace schema (not DDL — use table_schema for DDL).

table

string

—

Target table/view name.

create_table

bool

true

Streaming table only; snapshot_cdc and replace force true, and replace_where rejects false.

temporary

bool

false

Emitted as temporary=. temporary: true is rejected by replace_where.

private

bool

false

Emitted as private=. Creates the table for the pipeline’s lifetime without publishing it to the metastore; the dataset is visible only inside the pipeline.

comment

string

derived

Defaults to a description derived from the target table name.

table_properties

dict

—

Delta table properties.

tags

dict

—

UC tags {key: value}; applied by a generated tagging hook (REST API), not table DDL. See Unity Catalog tagging.

tags_file

string

—

Path to a unified schema/tags file (convention schemas/<table>.yaml) whose table-level tags and per-column tags supply UC tags. May be the same file as table_schema. Mutually exclusive with an inline tags mapping. See Schema and tag files.

partition_columns

list

—

Emitted as partition_cols=. Mutually exclusive with cluster_columns and cluster_by_auto: Databricks does not allow partitioning together with liquid clustering, so lhp validate and lhp generate reject the combination, even on an action with create_table: false. An empty list counts as unset.

cluster_columns

list

—

Liquid clustering; emitted as cluster_by=. With cluster_by_auto, these become the initial clustering keys. Mutually exclusive with partition_columns.

cluster_by_auto

bool

—

Auto liquid clustering. Can be combined with cluster_columns, which become the initial clustering keys; Databricks may later change the keys based on the workload. true is mutually exclusive with partition_columns.

spark_conf

dict

—

Spark configuration.

table_schema

string

—

Inline DDL, or a .ddl/.sql/.yaml/.json file path (auto-detected). A .yaml/.json file is the unified schema/tags file; its per-column type/nullable/comment are read here. Any UC tags it carries are ignored unless the same file is also set as tags_file — otherwise lhp generate warns LHP-CFG-069.

row_filter

string

—

Row-filter clause, emitted as row_filter=.

path

string

—

Storage location, emitted as path=.

database

string

—

Deprecated (removed at 1.0.0); use catalog + schema.

Added in version 0.9.2: The private field, for SDP private datasets that persist for the pipeline’s lifetime without being published to the metastore.

Action fields

These fields sit on the action, alongside write_target.

Field

Type

Default

Requirement and behaviour

name

string

required

Action name, unique within the flowgroup.

type

string

required

Always write.

source

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 snapshot_cdc_config. Materialized views require one of action source, target sql or target sql_path.

write_target

mapping

required

Target settings; type selects streaming_table, materialized_view or sink.

description

string

derived

Comment/docstring for the generated flow or view.

readMode

string

stream

stream or batch for standard streaming-table append flows. Replace requires streaming; replace_where reads in batch and rejects stream. Materialized views use batch queries; sinks use streaming reads. The read must match the kind of the view it reads, or lhp validate fails with LHP-VAL-070; a batch read in a standard streaming-table flow also needs once: true.

once

bool

false

Emits once=True for standard append and CDC flows. Not emitted for snapshot CDC, replace, replace_where, materialized views or sinks.

operational_metadata

bool / list

—

Accepted on the model; writes do not add metadata columns. Select columns on load or supported transform actions instead.

depends_on

list[string]

—

Extra upstream table/view references. See Dependency analysis reference.