Skip to content

How to merge correctly? #149

@rangp

Description

@rangp

I am missing documentation on how merging works with DeltaLake.DotNet.

I looked at the delta-rs documentation and there it seems that the sdk uses some sort of merge query builder, e.g.

DeltaOps(table)
    .merge(source_data, "target.x = source.x")
    .with_source_alias("source")
    .with_target_alias("target")
    .when_matched_update(|update| 
        update
        .update("x", "source.x")
        .update("y", "source.y"))?
    .await?;

Since this library says it is a rust port, I would expect a similar behavior, but the only method I could find in the ITable interface

Task MergeAsync(string query, IReadOnlyCollection<RecordBatch> records, Schema schema, CancellationToken cancellationToken);

only returns a task. I suspect there is some magic hidden in the query, but I have no idea how to write it correctly. Especially how aliases are defined. Are source and target some magic keywords that I can use without defining them?

I would appreciate some guidance/documentation on how to performe a simple upsert via merge. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions