<?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: Best Incremental Refresh Strategy in Fabric for On-Prem SQL Server Source with Updateable Records in Pipelines</title>
    <link>https://community.fabric.microsoft.com/t5/Pipelines/Best-Incremental-Refresh-Strategy-in-Fabric-for-On-Prem-SQL/m-p/4838020#M8580</link>
    <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="249674" data-lia-user-login="Alaahady" class="lia-mention lia-mention-user"&gt;Alaahady&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You’re dealing with the classic “insert + update” problem from an on-prem SQL Server. The trick is to &lt;STRONG&gt;land only what changed&lt;/STRONG&gt;, then &lt;STRONG&gt;upsert efficiently&lt;/STRONG&gt;, and &lt;STRONG&gt;serve for reporting&lt;/STRONG&gt;. Here’s what I’ve found works consistently.&lt;/P&gt;&lt;H2&gt;Quick solution&lt;/H2&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;Ingestion method:&lt;/STRONG&gt;&lt;BR /&gt;Use &lt;STRONG&gt;Dataflow Gen2&lt;/STRONG&gt; (incremental refresh on last_update_date) &lt;STRONG&gt;or&lt;/STRONG&gt; &lt;STRONG&gt;Pipeline Copy Activity&lt;/STRONG&gt; (incremental mode) through the &lt;STRONG&gt;on-premises data gateway&lt;/STRONG&gt; to land just the last N days/weeks of changes into a &lt;STRONG&gt;staging&lt;/STRONG&gt; table.&lt;BR /&gt;Docs: &lt;A href="https://learn.microsoft.com/en-us/fabric/data-factory/dataflow-gen2-incremental-refresh" target="_blank" rel="noopener"&gt;Dataflow Gen2 Incremental Refresh&lt;/A&gt;, &lt;A href="https://learn.microsoft.com/en-us/fabric/data-factory/how-to-access-on-premises-data" target="_blank" rel="noopener"&gt;On-premises data (gateway)&lt;/A&gt;, overview pattern from ADF: &lt;A href="https://learn.microsoft.com/en-us/azure/data-factory/tutorial-incremental-copy-overview" target="_blank" rel="noopener"&gt;Incremental copy (watermark)&lt;/A&gt;.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Destination for serving/reporting:&lt;/STRONG&gt;&lt;BR /&gt;Prefer &lt;STRONG&gt;Warehouse&lt;/STRONG&gt; (good T-SQL surface, easy PBI connectivity). &lt;STRONG&gt;MERGE is supported (preview)&lt;/STRONG&gt;, which enables straight T-SQL upserts. See: &lt;A href="https://learn.microsoft.com/en-us/fabric/data-warehouse/tsql-surface-area" target="_blank" rel="noopener"&gt;T-SQL surface area (Warehouse)&lt;/A&gt;.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Bronze &amp;gt; Gold recommended:&lt;/STRONG&gt;&lt;BR /&gt;Yes. Land delta rows into &lt;STRONG&gt;Bronze (staging)&lt;/STRONG&gt;, then &lt;STRONG&gt;MERGE into Gold&lt;/STRONG&gt; (reporting) with keys + last_update_date. The MERGE can be a &lt;STRONG&gt;Warehouse stored proc&lt;/STRONG&gt; or a &lt;STRONG&gt;Spark notebook MERGE&lt;/STRONG&gt; (if you choose Lakehouse Delta tables).&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Efficient update handling:&lt;/STRONG&gt;&lt;BR /&gt;Use a &lt;STRONG&gt;watermark table&lt;/STRONG&gt; that stores the last successful last_update_date. Your ingestion filters &amp;gt; watermark at source. After a successful upsert, bump the watermark. For sources that support it, &lt;STRONG&gt;SQL Server Change Tracking&lt;/STRONG&gt; also works well; pattern reference (ADF): &lt;A href="https://learn.microsoft.com/en-us/azure/data-factory/tutorial-incremental-copy-change-tracking-feature-portal" target="_blank" rel="noopener"&gt;Change Tracking incremental pattern&lt;/A&gt;.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 29 Sep 2025 13:56:03 GMT</pubDate>
    <dc:creator>tayloramy</dc:creator>
    <dc:date>2025-09-29T13:56:03Z</dc:date>
    <item>
      <title>Best Incremental Refresh Strategy in Fabric for On-Prem SQL Server Source with Updateable Records</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Best-Incremental-Refresh-Strategy-in-Fabric-for-On-Prem-SQL/m-p/4837850#M8579</link>
      <description>&lt;P&gt;Hi Fabric Community,&lt;/P&gt;&lt;P&gt;I'm currently working on optimizing an &lt;STRONG&gt;incremental refresh strategy&lt;/STRONG&gt; in Microsoft Fabric and would appreciate your insights on the best combination of tools and destinations.&lt;/P&gt;&lt;H3&gt;&lt;span class="lia-unicode-emoji" title=":pushpin:"&gt;📌&lt;/span&gt; &lt;STRONG&gt;Scenario Overview:&lt;/STRONG&gt;&lt;/H3&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;Source:&lt;/STRONG&gt; On-premises SQL Server&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Table Structure:&lt;/STRONG&gt; Contains ID and last_update_date columns&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Refresh Logic:&lt;/STRONG&gt;&lt;UL&gt;&lt;LI&gt;New records have unique IDs&lt;/LI&gt;&lt;LI&gt;Updated records have last_update_date within the last 2 months&lt;/LI&gt;&lt;LI&gt;I want to refresh only records where last_update_date &amp;gt; MAX(last_update_date) in the destination&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;H3&gt;&lt;span class="lia-unicode-emoji" title=":question_mark:"&gt;❓&lt;/span&gt; &lt;STRONG&gt;Questions:&lt;/STRONG&gt;&lt;/H3&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Which ingestion method is best suited for this use case?&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;Copy Activity in Pipeline&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Dataflow Gen2&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Copy Job&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Notebook with MERGE logic&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Which destination is most appropriate for incremental refresh and reporting?&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;Lakehouse (currently not supported)&amp;nbsp;&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Warehouse&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;SQL Database in Fabric&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Do I need to stage the data in a Bronze layer first and then merge into a Gold layer?&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If so, should this be done via Notebooks or Dataflows?&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Is there a recommended pattern for handling updates efficiently (e.g., using watermark tables, CDC, or timestamp filters)?&lt;/STRONG&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;H3&gt;&lt;span class="lia-unicode-emoji" title=":direct_hit:"&gt;🎯&lt;/span&gt; &lt;STRONG&gt;Goal:&lt;/STRONG&gt;&lt;/H3&gt;&lt;P&gt;Achieve a reliable and scalable incremental refresh setup that supports:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Efficient upserts (insert/update)&lt;/LI&gt;&lt;LI&gt;Minimal compute usage&lt;/LI&gt;&lt;LI&gt;Compatibility with reporting tools (Power BI, SQL endpoints)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Any best practices, architecture suggestions, or lessons learned from similar implementations would be greatly appreciated.&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;Alaa Abdulhady&lt;/P&gt;</description>
      <pubDate>Mon, 29 Sep 2025 11:53:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Best-Incremental-Refresh-Strategy-in-Fabric-for-On-Prem-SQL/m-p/4837850#M8579</guid>
      <dc:creator>Alaahady</dc:creator>
      <dc:date>2025-09-29T11:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: Best Incremental Refresh Strategy in Fabric for On-Prem SQL Server Source with Updateable Records</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Best-Incremental-Refresh-Strategy-in-Fabric-for-On-Prem-SQL/m-p/4838020#M8580</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="249674" data-lia-user-login="Alaahady" class="lia-mention lia-mention-user"&gt;Alaahady&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You’re dealing with the classic “insert + update” problem from an on-prem SQL Server. The trick is to &lt;STRONG&gt;land only what changed&lt;/STRONG&gt;, then &lt;STRONG&gt;upsert efficiently&lt;/STRONG&gt;, and &lt;STRONG&gt;serve for reporting&lt;/STRONG&gt;. Here’s what I’ve found works consistently.&lt;/P&gt;&lt;H2&gt;Quick solution&lt;/H2&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;Ingestion method:&lt;/STRONG&gt;&lt;BR /&gt;Use &lt;STRONG&gt;Dataflow Gen2&lt;/STRONG&gt; (incremental refresh on last_update_date) &lt;STRONG&gt;or&lt;/STRONG&gt; &lt;STRONG&gt;Pipeline Copy Activity&lt;/STRONG&gt; (incremental mode) through the &lt;STRONG&gt;on-premises data gateway&lt;/STRONG&gt; to land just the last N days/weeks of changes into a &lt;STRONG&gt;staging&lt;/STRONG&gt; table.&lt;BR /&gt;Docs: &lt;A href="https://learn.microsoft.com/en-us/fabric/data-factory/dataflow-gen2-incremental-refresh" target="_blank" rel="noopener"&gt;Dataflow Gen2 Incremental Refresh&lt;/A&gt;, &lt;A href="https://learn.microsoft.com/en-us/fabric/data-factory/how-to-access-on-premises-data" target="_blank" rel="noopener"&gt;On-premises data (gateway)&lt;/A&gt;, overview pattern from ADF: &lt;A href="https://learn.microsoft.com/en-us/azure/data-factory/tutorial-incremental-copy-overview" target="_blank" rel="noopener"&gt;Incremental copy (watermark)&lt;/A&gt;.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Destination for serving/reporting:&lt;/STRONG&gt;&lt;BR /&gt;Prefer &lt;STRONG&gt;Warehouse&lt;/STRONG&gt; (good T-SQL surface, easy PBI connectivity). &lt;STRONG&gt;MERGE is supported (preview)&lt;/STRONG&gt;, which enables straight T-SQL upserts. See: &lt;A href="https://learn.microsoft.com/en-us/fabric/data-warehouse/tsql-surface-area" target="_blank" rel="noopener"&gt;T-SQL surface area (Warehouse)&lt;/A&gt;.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Bronze &amp;gt; Gold recommended:&lt;/STRONG&gt;&lt;BR /&gt;Yes. Land delta rows into &lt;STRONG&gt;Bronze (staging)&lt;/STRONG&gt;, then &lt;STRONG&gt;MERGE into Gold&lt;/STRONG&gt; (reporting) with keys + last_update_date. The MERGE can be a &lt;STRONG&gt;Warehouse stored proc&lt;/STRONG&gt; or a &lt;STRONG&gt;Spark notebook MERGE&lt;/STRONG&gt; (if you choose Lakehouse Delta tables).&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Efficient update handling:&lt;/STRONG&gt;&lt;BR /&gt;Use a &lt;STRONG&gt;watermark table&lt;/STRONG&gt; that stores the last successful last_update_date. Your ingestion filters &amp;gt; watermark at source. After a successful upsert, bump the watermark. For sources that support it, &lt;STRONG&gt;SQL Server Change Tracking&lt;/STRONG&gt; also works well; pattern reference (ADF): &lt;A href="https://learn.microsoft.com/en-us/azure/data-factory/tutorial-incremental-copy-change-tracking-feature-portal" target="_blank" rel="noopener"&gt;Change Tracking incremental pattern&lt;/A&gt;.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Sep 2025 13:56:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Best-Incremental-Refresh-Strategy-in-Fabric-for-On-Prem-SQL/m-p/4838020#M8580</guid>
      <dc:creator>tayloramy</dc:creator>
      <dc:date>2025-09-29T13:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: Best Incremental Refresh Strategy in Fabric for On-Prem SQL Server Source with Updateable Records</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Best-Incremental-Refresh-Strategy-in-Fabric-for-On-Prem-SQL/m-p/4838810#M8586</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="249674" data-lia-user-login="Alaahady" class="lia-mention lia-mention-user"&gt;Alaahady&lt;/a&gt;,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thank you for reaching out to the Microsoft Fabric Community Forum. Also, thanks to&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1340679" data-lia-user-login="tayloramy" class="lia-mention lia-mention-user"&gt;tayloramy&lt;/a&gt;,&amp;nbsp;for his inputs on this thread.&lt;BR /&gt;&lt;BR /&gt;This is a common pattern when working with on-prem SQL Server sources and incremental refresh in Fabric. Here’s a practical approach you can consider:&lt;BR /&gt;&lt;BR /&gt;Ingest only changed rows: Use a Copy Activity or Copy Job via a self-hosted Integration Runtime to pull only rows where last_update_date is greater than the latest value in your destination (watermark). This keeps your ingestion lightweight and avoids unnecessary full-table copies.&lt;BR /&gt;&lt;BR /&gt;If you can enable Change Data Capture (CDC) on SQL Server, it’s even more robust for inserts/updates/deletes.&lt;BR /&gt;Landing zone (Bronze layer): Store the delta rows in a Bronze Delta Lakehouse table. Keep this append-only; each pipeline run writes only the new/updated rows.&lt;BR /&gt;&lt;BR /&gt;Upsert into Gold layer: Use a Notebook (Spark) or Dataflow Gen2 to perform a MERGE from Bronze into your Gold Delta table. Match on ID and compare last_update_date to handle inserts/updates atomically.&lt;BR /&gt;&lt;BR /&gt;Expose Gold for reporting: Use the Lakehouse SQL endpoint for smaller concurrency reports. Use a Warehouse if you have high-concurrency or interactive Power BI users.&lt;BR /&gt;&lt;BR /&gt;Refer these links: &lt;BR /&gt;1. &lt;A href="https://learn.microsoft.com/en-us/fabric/data-factory/dataflow-gen2-incremental-refresh" target="_blank"&gt;https://learn.microsoft.com/en-us/fabric/data-factory/dataflow-gen2-incremental-refresh&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;2. &lt;A href="https://learn.microsoft.com/en-us/fabric/fundamentals/decision-guide-lakehouse-warehouse" target="_blank"&gt;https://learn.microsoft.com/en-us/fabric/fundamentals/decision-guide-lakehouse-warehouse&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;3. &lt;A href="https://learn.microsoft.com/en-us/azure/data-factory/copy-activity-overview" target="_blank"&gt;https://learn.microsoft.com/en-us/azure/data-factory/copy-activity-overview&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;4. &lt;A href="https://learn.microsoft.com/en-us/azure/databricks/delta/merge" target="_blank"&gt;https://learn.microsoft.com/en-us/azure/databricks/delta/merge&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Hope this clears it up. Let us know if you have any doubts regarding this. We will be happy to help.&lt;/P&gt;
&lt;P&gt;Thank you for using the Microsoft Fabric Community Forum.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Sep 2025 08:52:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Best-Incremental-Refresh-Strategy-in-Fabric-for-On-Prem-SQL/m-p/4838810#M8586</guid>
      <dc:creator>v-kpoloju-msft</dc:creator>
      <dc:date>2025-09-30T08:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: Best Incremental Refresh Strategy in Fabric for On-Prem SQL Server Source with Updateable Records</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Best-Incremental-Refresh-Strategy-in-Fabric-for-On-Prem-SQL/m-p/4841028#M8595</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="249674" data-lia-user-login="Alaahady" class="lia-mention lia-mention-user"&gt;Alaahady&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;Just checking in to see if the issue has been resolved on your end. If the earlier suggestions helped, that’s great to hear! And if you’re still facing challenges, feel free to share more details happy to assist further.&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Oct 2025 04:13:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Best-Incremental-Refresh-Strategy-in-Fabric-for-On-Prem-SQL/m-p/4841028#M8595</guid>
      <dc:creator>v-kpoloju-msft</dc:creator>
      <dc:date>2025-10-03T04:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: Best Incremental Refresh Strategy in Fabric for On-Prem SQL Server Source with Updateable Records</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Best-Incremental-Refresh-Strategy-in-Fabric-for-On-Prem-SQL/m-p/4842711#M8601</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="249674" data-lia-user-login="Alaahady" class="lia-mention lia-mention-user"&gt;Alaahady&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;Hope you had a chance to try out the solution shared earlier. Let us know if anything needs further clarification or if there's an update from your side always here to help.&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Oct 2025 04:14:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Best-Incremental-Refresh-Strategy-in-Fabric-for-On-Prem-SQL/m-p/4842711#M8601</guid>
      <dc:creator>v-kpoloju-msft</dc:creator>
      <dc:date>2025-10-06T04:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: Best Incremental Refresh Strategy in Fabric for On-Prem SQL Server Source with Updateable Records</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Best-Incremental-Refresh-Strategy-in-Fabric-for-On-Prem-SQL/m-p/4843772#M8604</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Thank you all for your support. I was able to resolve the issue by following these steps:&lt;/STRONG&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Created a &lt;STRONG&gt;Dataflow Gen2&lt;/STRONG&gt; to build the gold fact table in the Lakehouse.&lt;/LI&gt;&lt;LI&gt;Created another &lt;STRONG&gt;Dataflow Gen2&lt;/STRONG&gt; to generate the silver table, filtered to include only the last 7 days of data.&lt;/LI&gt;&lt;LI&gt;Developed a &lt;STRONG&gt;notebook&lt;/STRONG&gt; to merge the silver data into the gold table.&lt;/LI&gt;&lt;LI&gt;Built a &lt;STRONG&gt;pipeline&lt;/STRONG&gt; that includes steps 2 and 3, and configured a schedule to automate the process.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is the notebook code:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;from&lt;/SPAN&gt; &lt;SPAN&gt;delta&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;tables&lt;/SPAN&gt; &lt;SPAN&gt;import&lt;/SPAN&gt; &lt;SPAN&gt;DeltaTable&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;from&lt;/SPAN&gt; &lt;SPAN&gt;pyspark&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;sql&lt;/SPAN&gt; &lt;SPAN&gt;import&lt;/SPAN&gt; &lt;SPAN&gt;SparkSession&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;# Start Spark session&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;spark&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;SparkSession&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;builder&lt;/SPAN&gt;&lt;SPAN&gt;.getOrCreate()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;# Load source and target tables (single-part names only)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;source_df&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;spark&lt;/SPAN&gt;&lt;SPAN&gt;.read.table(&lt;/SPAN&gt;&lt;SPAN&gt;"fact_survey_detail_silver"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;target_table&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;DeltaTable&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;forName&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;spark&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"fact_survey_detail"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;# Merge: update matching records and insert new ones&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;target_table&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;alias&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"gold"&lt;/SPAN&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;SPAN&gt;merge&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;source&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;source_df&lt;/SPAN&gt;&lt;SPAN&gt;.alias(&lt;/SPAN&gt;&lt;SPAN&gt;"silver"&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;condition&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"gold.id = silver.id"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;SPAN&gt;whenMatchedUpdateAll&lt;/SPAN&gt;&lt;SPAN&gt;() \&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;.&lt;/SPAN&gt;&lt;SPAN&gt;whenNotMatchedInsertAll&lt;/SPAN&gt;&lt;SPAN&gt;() \&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;.&lt;/SPAN&gt;&lt;SPAN&gt;execute&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I hope that can help other&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 06 Oct 2025 18:38:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Best-Incremental-Refresh-Strategy-in-Fabric-for-On-Prem-SQL/m-p/4843772#M8604</guid>
      <dc:creator>Alaahady</dc:creator>
      <dc:date>2025-10-06T18:38:26Z</dc:date>
    </item>
  </channel>
</rss>

