<?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: Ordering csv files to import historical data in a lakehouse in Pipelines</title>
    <link>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4913686#M8950</link>
    <description>&lt;P&gt;Ok, a sample notebook to accomplish a such task, please? Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 07 Jan 2026 08:12:44 GMT</pubDate>
    <dc:creator>pmscorca</dc:creator>
    <dc:date>2026-01-07T08:12:44Z</dc:date>
    <item>
      <title>Ordering csv files to import historical data in a lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4910007#M8934</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I need to import historical data about some file groups in a lakehouse.&lt;/P&gt;&lt;P&gt;Each file group has a specific prefix saved in a configuration table in a warehouse.&lt;/P&gt;&lt;P&gt;Each file group has a name composed of filegroupprefix_nn_fromdate_mm_todate, where nn and mm represent two digits (f.e. 01, 02, 03, 04, ..., 10, 11, 12, 13 and so on) and fromdate and todate are in yyyymmdd format.&lt;/P&gt;&lt;P&gt;For a specific file group, e.g. filegroup1prefix, I could have these csv files to import:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;filegroup1prefix_01_20250101_01_20250201&lt;/LI&gt;&lt;LI&gt;filegroup1prefix_01_20250101_02_20250202&lt;/LI&gt;&lt;LI&gt;filegroup1prefix_01_20250101_03_20250203&lt;/LI&gt;&lt;LI&gt;filegroup1prefix_01_20250101_04_20250204&lt;/LI&gt;&lt;LI&gt;etc. etc.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Each file covers about two months of data: the&amp;nbsp;filegroup1prefix_01_20250101_01_20250201 csv file contains data between 20250101 date (January) and 20250201 date (February).&lt;BR /&gt;Moreover,&amp;nbsp;filegroup1prefix_01_20250101_02_20250202 data have to overwrite&amp;nbsp;filegroup1prefix_01_20250101_01_20250201 data,&amp;nbsp;filegroup1prefix_01_20250101_03_20250203 data have to overwrite&amp;nbsp;filegroup1prefix_01_20250101_02_20250202 and so on.&lt;BR /&gt;So, in order to avoid any mistakes, I need to work the csv files following the file name order.&lt;BR /&gt;I think to implement a pipeline that runs:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;a lookup against the configuration table in the warehouse to get the file group prefixes,&lt;/LI&gt;&lt;LI&gt;a for each to save in a variable the specific prefix, then a get metadata against the on-premise folder to get the name of all csv files, then a filter to select the csv files belonging to the specific group file, but I cannot order these file names saved in an array.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Now, any suggests to me in order to solve a such issue, please? Thanks&lt;/P&gt;&lt;P&gt;I've tried to search a specific regular expression,&amp;nbsp;something similar to "@sort"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Update: while I think a good solution, I've created this idea --&amp;gt;&lt;BR /&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Fabric-Ideas/Feature-to-order-an-array-into-a-pipeline/idi-p/4910172#M165772" target="_blank" rel="noopener"&gt;Feature to order an array into a pipeline - Microsoft Fabric Community&lt;/A&gt;&lt;BR /&gt;Please vote it, thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Dec 2025 06:39:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4910007#M8934</guid>
      <dc:creator>pmscorca</dc:creator>
      <dc:date>2025-12-30T06:39:51Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering csv files to import historical data in a lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4910030#M8935</link>
      <description>&lt;P&gt;not clear why the order of processing would be important here? What kind of mistakes are you anticipating?&lt;/P&gt;</description>
      <pubDate>Mon, 29 Dec 2025 19:05:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4910030#M8935</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2025-12-29T19:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering csv files to import historical data in a lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4910069#M8936</link>
      <description>&lt;P&gt;Because old files could overwrite more recent files.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Dec 2025 21:45:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4910069#M8936</guid>
      <dc:creator>pmscorca</dc:creator>
      <dc:date>2025-12-29T21:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering csv files to import historical data in a lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4910404#M8938</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;The way that I would approach this is by landing the files in a lakehouse, and then using a notebook to load them so you can ensure things load in the order you want (filename, and not the sys modified time).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then you load the data into a lakehouse table, and from there you can move it into the warehouse.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Dec 2025 14:48:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4910404#M8938</guid>
      <dc:creator>tayloramy</dc:creator>
      <dc:date>2025-12-30T14:48:51Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering csv files to import historical data in a lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4911002#M8940</link>
      <description>&lt;P&gt;Thankyou,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;&amp;nbsp;and&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 your responses.&lt;BR /&gt;&lt;BR /&gt;Hi pmscorca,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;We appreciate your inquiry on the Microsoft Fabric Community Forum.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Based on my understanding, in Fabric Data Pipelines, arrays returned by Get Metadata or Lookup activities cannot be sorted, and the execution order of ForEach is non-deterministic. Consequently, pipelines cannot guarantee filename based processing order, which may result in older CSV files overwriting newer data when overwrite logic is applied.&lt;/P&gt;
&lt;P&gt;One workaround is to follow the approach suggested by @tayloramy.&lt;/P&gt;
&lt;P&gt;Your idea to support array sorting within pipelines is valid and addresses the gap. Until such a capability is introduced, notebook based ordered ingestion is a feasible workaround.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Additionally, please refer the links below:&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/fabric/data-engineering/how-to-use-notebook" target="_blank"&gt;How to use notebooks - Microsoft Fabric | Microsoft Learn&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/fabric/cicd/deployment-pipelines/intro-to-deployment-pipelines?tabs=new-ui" target="_blank"&gt;Overview of Fabric deployment pipelines - Microsoft Fabric | Microsoft Learn&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/fabric/cicd/deployment-pipelines/understand-the-deployment-process?tabs=new-ui" target="_blank"&gt;The Microsoft Fabric deployment pipelines process - Microsoft Fabric | Microsoft Learn&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;We hope the information provided helps to resolve the issue. Should you have any further queries, please feel free to contact the Microsoft Fabric community.&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Dec 2025 17:52:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4911002#M8940</guid>
      <dc:creator>v-pnaroju-msft</dc:creator>
      <dc:date>2025-12-31T17:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering csv files to import historical data in a lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4911862#M8941</link>
      <description>&lt;P&gt;Hi, thanks four you reply but I hopo to vote my idea, please.&lt;/P&gt;&lt;P&gt;I'd like to use a notebook only to order the file names saved in an array, next I'd like to use the for each activity to iterate the array from the first ordered file name to the last one: it is the right approach, isn't it? Thanks&lt;/P&gt;</description>
      <pubDate>Sat, 03 Jan 2026 11:34:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4911862#M8941</guid>
      <dc:creator>pmscorca</dc:creator>
      <dc:date>2026-01-03T11:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering csv files to import historical data in a lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4911880#M8942</link>
      <description>&lt;P&gt;Not really. You are trying to prevent parallelism from happening, and you are reducing the robustness of your ingestion process. Typical "fighting the API" pattern.&lt;/P&gt;</description>
      <pubDate>Sat, 03 Jan 2026 13:04:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4911880#M8942</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2026-01-03T13:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering csv files to import historical data in a lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4912726#M8945</link>
      <description>&lt;P&gt;Hi pmscorca,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Thank you for the followup. We have already upvoted the suggestion on the forum.&lt;/P&gt;
&lt;P&gt;Based on my understanding, using a notebook to sort file names and then passing the resulting array to a pipeline ForEach is not a reliable pattern in Fabric. Pipelines do not guarantee ordered execution across activity boundaries. When file order is critical, both sorting and ingestion should be performed within the notebook. Pipelines ought to be used only to orchestrate the execution of the notebook. This is the supported and most robust approach in Fabric.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;We hope this information helps resolve the issue. If you have any further queries, please feel free to contact the Microsoft Fabric community.&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jan 2026 18:25:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4912726#M8945</guid>
      <dc:creator>v-pnaroju-msft</dc:creator>
      <dc:date>2026-01-05T18:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering csv files to import historical data in a lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4913255#M8947</link>
      <description>&lt;P&gt;Hi and many thanks for your reply.&lt;/P&gt;&lt;P&gt;Any suggests to perform a such ingestion within a notebook? Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jan 2026 15:04:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4913255#M8947</guid>
      <dc:creator>pmscorca</dc:creator>
      <dc:date>2026-01-06T15:04:06Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering csv files to import historical data in a lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4913633#M8948</link>
      <description>&lt;P&gt;Hi pmscorca,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Thank you for the followup.&lt;/P&gt;
&lt;P&gt;Based on my understanding, to ensure correct overwrite behavior you should list, sort, and ingest the files sequentially within a Fabric notebook. This ensures deterministic execution and is the supported approach when file order matters. Pipelines should be used only to orchestrate the execution of the notebook.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;We hope this information helps to resolve the issue. Should you have any further queries, please feel free to contact the Microsoft Fabric community.&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jan 2026 05:58:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4913633#M8948</guid>
      <dc:creator>v-pnaroju-msft</dc:creator>
      <dc:date>2026-01-07T05:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering csv files to import historical data in a lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4913686#M8950</link>
      <description>&lt;P&gt;Ok, a sample notebook to accomplish a such task, please? Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jan 2026 08:12:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4913686#M8950</guid>
      <dc:creator>pmscorca</dc:creator>
      <dc:date>2026-01-07T08:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering csv files to import historical data in a lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4915614#M8959</link>
      <description>&lt;P&gt;Hi pmscorca,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Please find the sample code and screenshots attached below, which may help resolve the issue:&lt;BR /&gt;1.Input files:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;2. Output table:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;3. Sample code:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&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;functions&lt;/SPAN&gt; &lt;SPAN&gt;as&lt;/SPAN&gt; &lt;SPAN&gt;F&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;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;# Step 1: Path to files in Lakehouse&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;files_path&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;"Files/bronze/filegroup1prefix/"&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;SPAN&gt;# Step 2: List CSV files&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;files_df&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;spark&lt;/SPAN&gt;&lt;SPAN&gt;.read.&lt;/SPAN&gt;&lt;SPAN&gt;format&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"binaryFile"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; .load(&lt;/SPAN&gt;&lt;SPAN&gt;files_path&lt;/S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&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;files_df&lt;/SPAN&gt;&lt;SPAN&gt;.orderBy(&lt;/SPAN&gt;&lt;SPAN&gt;"seq"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;SPAN&gt;# Step 5: Sequential ingestion with overwrite&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;for&lt;/SPAN&gt; &lt;SPAN&gt;row&lt;/SPAN&gt; &lt;SPAN&gt;in&lt;/SPAN&gt; &lt;SPAN&gt;ordered_files&lt;/SPAN&gt;&lt;SPAN&gt;.collect():&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;df&lt;/SPAN&gt;&lt;SPAN&gt; = (&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;spark&lt;/SPAN&gt;&lt;SPAN&gt;.read&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .option(&lt;/SPAN&gt;&lt;SPAN&gt;"header"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;True&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .option(&lt;/SPAN&gt;&lt;SPAN&gt;"dateFormat"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"MM/dd/yyyy"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .csv(&lt;/SPAN&gt;&lt;SPAN&gt;row&lt;/SPAN&gt;&lt;SPAN&gt;.path)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;df&lt;/SPAN&gt;&lt;SPAN&gt;.write \&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/SPAN&gt;&lt;SPAN&gt;format&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"delta"&lt;/SPAN&gt;&lt;SPAN&gt;) \&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; .mode(&lt;/SPAN&gt;&lt;SPAN&gt;"overwrite"&lt;/SPAN&gt;&lt;SPAN&gt;) \&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; .saveAsTable(&lt;/SPAN&gt;&lt;SPAN&gt;"sales_final"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;SPAN&gt;print&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"Ordered ingestion completed successfully."&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;We hope the information provided is helpful. If you have any further queries, please feel free to contact the Microsoft Fabric community.&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2026 16:43:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4915614#M8959</guid>
      <dc:creator>v-pnaroju-msft</dc:creator>
      <dc:date>2026-01-09T16:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: Ordering csv files to import historical data in a lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4916822#M8963</link>
      <description>&lt;P&gt;Hi pmscorca,&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We would like to follow up and see whether the details we shared have resolved your problem.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;If you need any more assistance, please feel free to connect with the Microsoft Fabric community.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jan 2026 14:42:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Ordering-csv-files-to-import-historical-data-in-a-lakehouse/m-p/4916822#M8963</guid>
      <dc:creator>v-pnaroju-msft</dc:creator>
      <dc:date>2026-01-12T14:42:25Z</dc:date>
    </item>
  </channel>
</rss>

