<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to implement MERGE operations in Lakeflow Declarative Pipelines in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-implement-merge-operations-in-lakeflow-declarative/m-p/154645#M54118</link>
    <description>&lt;P&gt;Could you please provide an actual sample how to do this.&lt;/P&gt;</description>
    <pubDate>Wed, 15 Apr 2026 12:27:45 GMT</pubDate>
    <dc:creator>de-qrosh</dc:creator>
    <dc:date>2026-04-15T12:27:45Z</dc:date>
    <item>
      <title>How to implement MERGE operations in Lakeflow Declarative Pipelines</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-implement-merge-operations-in-lakeflow-declarative/m-p/133249#M49761</link>
      <description>&lt;P&gt;Hey everyone,&lt;/P&gt;&lt;P&gt;We’ve been using Autoloader extensively for a while, and now we’re looking to transition to full Lakeflow Declarative Pipelines. From what I’ve researched, the &lt;STRONG&gt;reader&lt;/STRONG&gt; part seems straightforward and clear.&lt;/P&gt;&lt;P&gt;For the &lt;STRONG&gt;writer&lt;/STRONG&gt;, I understand that I can use a sink and provide the necessary options. What I’m not fully clear on is how to implement the &lt;STRONG&gt;MERGE logic&lt;/STRONG&gt;. In my current Autoloader setup, I handle this via forEachBatch.&lt;/P&gt;&lt;P&gt;How should this be approached in the Lakeflow Declarative Pipelines framework? Could I use forEachBatch? I did not find any documentation on the topic.&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Mon, 29 Sep 2025 12:49:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-implement-merge-operations-in-lakeflow-declarative/m-p/133249#M49761</guid>
      <dc:creator>yit</dc:creator>
      <dc:date>2025-09-29T12:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement MERGE operations in Lakeflow Declarative Pipelines</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-implement-merge-operations-in-lakeflow-declarative/m-p/133271#M49772</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/175553"&gt;@yit&lt;/a&gt;&amp;nbsp;&lt;SPAN&gt;Lakeflow supports upsert/merge semantics natively for Delta tables unlile ForEachBatch&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Instead of writing custom&amp;nbsp;forEachBatch&amp;nbsp;code, you declare the merge keys and update logic in your pipeline configuration.Lakeflow will automatically generate the necessary MERGE statements and handle upserts for you.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;e.g.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;sinks:&lt;BR /&gt;my_delta_sink:&lt;BR /&gt;type: delta&lt;BR /&gt;path: /mnt/delta/my_table&lt;BR /&gt;merge:&lt;BR /&gt;keys: ["id"] # columns to match for upsert&lt;BR /&gt;whenMatched: update&lt;BR /&gt;whenNotMatched: insert&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Sep 2025 14:06:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-implement-merge-operations-in-lakeflow-declarative/m-p/133271#M49772</guid>
      <dc:creator>saurabh18cs</dc:creator>
      <dc:date>2025-09-29T14:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement MERGE operations in Lakeflow Declarative Pipelines</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-implement-merge-operations-in-lakeflow-declarative/m-p/154645#M54118</link>
      <description>&lt;P&gt;Could you please provide an actual sample how to do this.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2026 12:27:45 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-implement-merge-operations-in-lakeflow-declarative/m-p/154645#M54118</guid>
      <dc:creator>de-qrosh</dc:creator>
      <dc:date>2026-04-15T12:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement MERGE operations in Lakeflow Declarative Pipelines</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-implement-merge-operations-in-lakeflow-declarative/m-p/154682#M54122</link>
      <description>&lt;DIV&gt;Use APPLY CHANGES INTO (SQL) or dlt.apply_changes() (Python). This is the declarative replacement for foreachBatch MERGE logic in pipelines&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import dlt
from pyspark.sql.functions import col

@dlt.table(name="bronze_events")
def bronze_events():
    return (spark.readStream
            .format("cloudFiles")
            .option("cloudFiles.format", "json")
            .load("abfss://container@account.dfs.core.windows.net/events/"))

dlt.apply_changes(
    target="customer",
    source="bronze_events",
    keys=["customer_id"],
    sequence_by=col("event_ts"),
    apply_as_deletes=col("op") == "DELETE",
    stored_as_scd_type=1
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2026 19:17:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-implement-merge-operations-in-lakeflow-declarative/m-p/154682#M54122</guid>
      <dc:creator>nayan_wylde</dc:creator>
      <dc:date>2026-04-15T19:17:51Z</dc:date>
    </item>
  </channel>
</rss>

