<?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 implementing an incremental data loading in Data Factory in Pipelines</title>
    <link>https://community.fabric.microsoft.com/t5/Pipelines/How-implementing-an-incremental-data-loading-in-Data-Factory/m-p/3917850#M3296</link>
    <description>&lt;P&gt;Depending on your requirement of source and data structure, availability you can try to see if it can be achieved within pipeline using UI, however in scenarios requiring larger control and complex mechanism you can try to use dataflow. You can also use pipeline with spark code of your choose provide much more control in CICD. It all would come down to the mechanisms in place, existing expertise available and the path organization would like to adapt.&lt;/P&gt;</description>
    <pubDate>Tue, 14 May 2024 15:41:53 GMT</pubDate>
    <dc:creator>bhanu_bi</dc:creator>
    <dc:date>2024-05-14T15:41:53Z</dc:date>
    <item>
      <title>How implementing an incremental data loading in Data Factory</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/How-implementing-an-incremental-data-loading-in-Data-Factory/m-p/3917823#M3294</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;in Data Factory of Microsoft Fabric how I could implement an incremental data load?&lt;/P&gt;&lt;P&gt;In Azure Data Factory I could use a mapping data flow to accomplish a such task.&lt;/P&gt;&lt;P&gt;In Fabric is there the good practice to follow? Using a data pipeline or a dataflow gen2?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 15:34:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/How-implementing-an-incremental-data-loading-in-Data-Factory/m-p/3917823#M3294</guid>
      <dc:creator>pmscorca</dc:creator>
      <dc:date>2024-05-14T15:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: How implementing an incremental data loading in Data Factory</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/How-implementing-an-incremental-data-loading-in-Data-Factory/m-p/3917850#M3296</link>
      <description>&lt;P&gt;Depending on your requirement of source and data structure, availability you can try to see if it can be achieved within pipeline using UI, however in scenarios requiring larger control and complex mechanism you can try to use dataflow. You can also use pipeline with spark code of your choose provide much more control in CICD. It all would come down to the mechanisms in place, existing expertise available and the path organization would like to adapt.&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 15:41:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/How-implementing-an-incremental-data-loading-in-Data-Factory/m-p/3917850#M3296</guid>
      <dc:creator>bhanu_bi</dc:creator>
      <dc:date>2024-05-14T15:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: How implementing an incremental data loading in Data Factory</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/How-implementing-an-incremental-data-loading-in-Data-Factory/m-p/3917887#M3297</link>
      <description>&lt;P&gt;Hi, for example to ingest a customer table to handle as a SCD2 reading data from an on-premise source (e.g. Oracle, csv files).&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 15:55:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/How-implementing-an-incremental-data-loading-in-Data-Factory/m-p/3917887#M3297</guid>
      <dc:creator>pmscorca</dc:creator>
      <dc:date>2024-05-14T15:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: How implementing an incremental data loading in Data Factory</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/How-implementing-an-incremental-data-loading-in-Data-Factory/m-p/3920709#M3341</link>
      <description>&lt;P&gt;There are different strategies for incremental loading.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using medallion architecture with one additional layer - Landing.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;There is lakehouse Landing where I ingest data with an overwrite option.&lt;/P&gt;&lt;P&gt;Here is the example of a data pipeline for 1 table&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;Get last WaterMark - read the&amp;nbsp;&lt;SPAN&gt;IncrementalLoadInfo table (columns&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;TableName and LastLoadDate) for the specific table to get the last loaded value:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SELECT COALESCE(
    (SELECT [LastLoadDate] FROM [dbo].[IncrementalLoadInfo] WHERE [TableName] =  '@{item().TableName}'),
    CAST('2020-01-01' AS DATETIME2)
) AS [LastLoadDate];&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2. Loading to Landing - copies the data from the origin to Landing (with Owerwrite). Query to source is:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SELECT * FROM [dbo].[@{item().TableName}]
WHERE Timestamp = '@{activity('Get last WaterMark').output.firstRow.LastLoadDate}'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3. Create Raw table - simply create the same table but in warehouse (Raw/Bronze)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CREATE TABLE [dbo].@{item().TableName} AS
SELECT *
FROM [Landing].[dbo].@{item().TableName};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;4. Loading from Landing to Raw - runs the Landing2Raw stored procedure&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CREATE PROC [dbo].[Landing2Raw]
    @TableSource NVARCHAR(MAX),
    @TableTarget NVARCHAR(MAX),
    @Condition NVARCHAR(MAX)
AS
BEGIN
    BEGIN TRANSACTION
        DECLARE @SetColumns NVARCHAR(MAX) = '';
        SELECT 
            @SetColumns = @setColumns + QUOTENAME(name) + ' = S.' + QUOTENAME(name) + ', '
        FROM [Landing].[sys].[columns]
        WHERE object_id = OBJECT_ID(@TableSource);
        SET @SetColumns = LEFT(@SetColumns, LEN(@SetColumns) - 1); -- Remove trailing comma
        DECLARE @Update NVARCHAR(MAX) = N'UPDATE ' + @TableTarget +
            ' SET ' + @setColumns +
            ' FROM ' + @TableSource + ' AS S' +
            ' INNER JOIN ' + @TableTarget + ' AS T ON S.' + @Condition +' = T.' + @Condition;
        EXEC sp_executesql @Update;
        DECLARE @Insert NVARCHAR(MAX) = 'INSERT ' + @TableTarget +
            ' SELECT * FROM ' + @TableSource + ' AS S WHERE NOT EXISTS (SELECT 1 FROM ' + @TableTarget +' WHERE ' + @Condition +' = S.' + @Condition + ')';
        EXEC sp_executesql @Insert;
    COMMIT TRANSACTION
END&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;it takes the data from Landing (just uploaded batch) and inserts or updates the data in the Raw warehouse.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;5.&amp;nbsp;Update WaterMark - just updates the load date for the table in the&amp;nbsp;&lt;SPAN&gt;IncrementalLoadInfo. Here I use stored procedure as well because the table could not have the record for this table that I'm loading:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CREATE PROC [dbo].[UpdateIncrementalLoadInfo]
    @TableName [VARCHAR](100),
    @CollectDate [DATETIME2](6)
AS
BEGIN
    IF EXISTS (SELECT 1 FROM [dbo].[IncrementalLoadInfo] WHERE [TableName] = @TableName)
    BEGIN
        UPDATE [dbo].[IncrementalLoadInfo]
        SET [LastLoadDate] = @CollectDate
        WHERE [TableName] = @TableName;
    END
    ELSE
    BEGIN
        INSERT [dbo].[IncrementalLoadInfo]
        SELECT @TableName, @CollectDate, NULL
    END;
END&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Hope it will be helpful to give you the idea. Ping me if you have more questions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: this approach doesn't handle data deletion (if you remove a record from your origin database)! For this use soft delete or consider CDC pattern&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Useful videos:&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://youtu.be/u3U9aHkvaF8?si=R_IrUCjtt3j2NJgK" target="_blank" rel="noopener"&gt;https://youtu.be/u3U9aHkvaF8?si=R_IrUCjtt3j2NJgK&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://youtu.be/706MVIBivOU?si=PzT_tjOaaGH1lsln" target="_blank" rel="noopener"&gt;https://youtu.be/706MVIBivOU?si=PzT_tjOaaGH1lsln&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://www.youtube.com/watch?v=B4zi6er628A&amp;amp;list=PLwozBGbewKFvbxRU7TgZBNeHN4X_zgOqP&amp;amp;index=5&amp;amp;t=979s" target="_blank" rel="noopener"&gt;Microsoft Fabric - Incremental ETL - YouTube&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Wed, 15 May 2024 12:35:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/How-implementing-an-incremental-data-loading-in-Data-Factory/m-p/3920709#M3341</guid>
      <dc:creator>Marusyk</dc:creator>
      <dc:date>2024-05-15T12:35:03Z</dc:date>
    </item>
    <item>
      <title>Re: How implementing an incremental data loading in Data Factory</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/How-implementing-an-incremental-data-loading-in-Data-Factory/m-p/3927998#M3403</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="719515" data-lia-user-login="pmscorca" class="lia-mention lia-mention-user"&gt;pmscorca&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet.&lt;BR /&gt;In case if you have any resolution please do share that same with the community as it can be helpful to others.&lt;BR /&gt;Otherwise, will respond back with the more details and we will try to help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2024 16:05:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/How-implementing-an-incremental-data-loading-in-Data-Factory/m-p/3927998#M3403</guid>
      <dc:creator>v-cboorla-msft</dc:creator>
      <dc:date>2024-05-17T16:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: How implementing an incremental data loading in Data Factory</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/How-implementing-an-incremental-data-loading-in-Data-Factory/m-p/3932250#M3426</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="719515" data-lia-user-login="pmscorca" class="lia-mention lia-mention-user"&gt;pmscorca&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. In case if you have any resolution please do share that same with the community as it can be helpful to others .&lt;BR /&gt;If you have any question relating to the current thread, please do let us know and we will try out best to help you.&lt;BR /&gt;In case if you have any other question on a different issue, we request you to open a new thread.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2024 11:04:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/How-implementing-an-incremental-data-loading-in-Data-Factory/m-p/3932250#M3426</guid>
      <dc:creator>v-cboorla-msft</dc:creator>
      <dc:date>2024-05-20T11:04:15Z</dc:date>
    </item>
  </channel>
</rss>

