Skip to content

DeltaMergeBuilder ​

Namespace: Polars.CSharp

A builder for constructing ordered Delta Lake Merge operations. This ensures that matched and not-matched conditions are evaluated exactly in the order they are chained by the user, adhering to standard SQL MERGE semantics.

Instance Methods ​

Execute ​

Executes the constructed merge operation against the Delta Table.

csharp
public void Execute()

WhenMatchedDelete ​

Delete the matched target row.

Delete the matched target row using a safe context builder.

csharp
public DeltaMergeBuilder WhenMatchedDelete(Expr? condition = null)
public DeltaMergeBuilder WhenMatchedDelete(Func<MergeContext, Expr> conditionBuilder)

Parameters

NameTypeDescription
conditionExpr?Optional condition for the delete to occur. If null, deletes all matched rows.
conditionBuilderFunc<MergeContext, Expr>-

WhenMatchedUpdate ​

Update the matched target row with source data.

Update the matched target row with source data using a safe context builder.

csharp
public DeltaMergeBuilder WhenMatchedUpdate(Expr? condition = null)
public DeltaMergeBuilder WhenMatchedUpdate(Func<MergeContext, Expr> conditionBuilder)

Parameters

NameTypeDescription
conditionExpr?Optional condition for the update to occur. If null, updates all matched rows.
conditionBuilderFunc<MergeContext, Expr>-

WhenNotMatchedBySourceDelete ​

Delete the target row when it does not exist in the source data.

Delete the target row when it does not exist in the source data using a safe context builder.

csharp
public DeltaMergeBuilder WhenNotMatchedBySourceDelete(Expr? condition = null)
public DeltaMergeBuilder WhenNotMatchedBySourceDelete(Func<MergeContext, Expr> conditionBuilder)

Parameters

NameTypeDescription
conditionExpr?Optional condition for the target delete to occur. If null, deletes all unmatched target rows.
conditionBuilderFunc<MergeContext, Expr>-

WhenNotMatchedInsert ​

Insert a new row from the source data when it does not match any target row.

Insert a new row from the source data using a safe context builder.

csharp
public DeltaMergeBuilder WhenNotMatchedInsert(Expr? condition = null)
public DeltaMergeBuilder WhenNotMatchedInsert(Func<MergeContext, Expr> conditionBuilder)

Parameters

NameTypeDescription
conditionExpr?Optional condition for the insert to occur. If null, inserts all unmatched source rows.
conditionBuilderFunc<MergeContext, Expr>-

Released under the MIT License. Powered by the Polars Rust core & Apache Arrow.