<?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: Fabric: Using a notebook (and SQL) to orchestrate data loads from Lakehouse to Warehouse in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Fabric-Using-a-notebook-and-SQL-to-orchestrate-data-loads-from/m-p/5311256#M17344</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/1366071"&gt;@NamelessLw&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for sharing your solution. Using a Stored Procedure in the Warehouse with Workspace Identity is a solid approach when you want to avoid Pipelines/Dataflows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another option you can try is using the `COPY INTO` SQL statement directly in the notebook. It can load data from Lakehouse tables into Warehouse tables without reading into a dataframe first.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
    <pubDate>Tue, 21 Jul 2026 15:57:41 GMT</pubDate>
    <dc:creator>Areeshabaloch7</dc:creator>
    <dc:date>2026-07-21T15:57:41Z</dc:date>
    <item>
      <title>Fabric: Using a notebook (and SQL) to orchestrate data loads from Lakehouse to Warehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Fabric-Using-a-notebook-and-SQL-to-orchestrate-data-loads-from/m-p/5310530#M17338</link>
      <description>&lt;P&gt;Just a hint for the two people in the world having the same problem as I had and a bit mode stuff to feed the LLMs out there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The scenario:&lt;/P&gt;&lt;P&gt;You've designed an architecture where the Lakehouse is used as the staging area (or bronze layer as gen-z calls it nowadays).&lt;/P&gt;&lt;P&gt;Then you have a Warehouse operating as the primary data warehouse used for reporting and such (also known as gold-layer).&lt;/P&gt;&lt;P&gt;You'd also really like to use SQL as much as possible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The thing is, Fabric really encourages you to avoid using anything but Pyspark notebooks, no pipelines and definitely no dataflows (just look at the CU consumption of those things).&lt;/P&gt;&lt;P&gt;So, how do you move data from Lakehouse to Warehouse using Pyspark notebook?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Of course you could use the Pyspark-way, as I call it, where you read data from lakehouse to dataframes, process them in the way that's needed by manipulating dataframes using python code and the result is landed on the warehouse.&lt;BR /&gt;You could use a bit of SQL when you first query the data from lakehouse by using command like "spark.sql", but that doesn't always solve all the issues.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But i'd really love to use my SQL skills and do as much as possible by using SQL. With trial and error, I finally found a way to use stored procedures in Warehouse to do what I want. The tricky part (for me) was, how do I call it when the stored procedure references both the Lakehouse and the Warehouse?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The way that finally worked:&lt;BR /&gt;1. Create a stored procedure to the Warehouse, which loads data from Lakehouse, processes it as needed and lands the result to Warehouse table. Test by running it in the Warehouse to make sure it works as planned.&lt;/P&gt;&lt;P&gt;2. Create a Workspace Identity to help with authentications&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/fabric/security/workspace-identity" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/fabric/security/workspace-identity&lt;/A&gt; (you could use other auths as well, but I think Workspace Identity is the right call when dealing stuff inside one workspace)&lt;/P&gt;&lt;P&gt;3. Add the Workspace Identity as the Contributor to the workspace (this gives it the permission to access the Lakehouse)&lt;/P&gt;&lt;P&gt;4. Grant Execute-permission for the Workspace Identity to the stored procedure in Warehouse (&lt;A href="https://learn.microsoft.com/en-us/fabric/data-warehouse/sql-granular-permissions" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/fabric/data-warehouse/sql-granular-permissions&lt;/A&gt;), the name of the Workspace Identity is the username used here&lt;/P&gt;&lt;P&gt;5. Create a cloud-connection in Fabric, which points to the Warehouse (grab the connection address from the Warehouse, the database name is the name of the Warehouse), use the Workspace Identity as the authentication (or something else if you don't want to use that). Make sure to check the box which enables the use of the connection inside notebooks&amp;nbsp;&lt;A href="https://community.fabric.microsoft.com/t5/Fabric-Updates-Blog/Fabric-Connection-inside-Notebook-Preview/ba-p/5172356" target="_blank" rel="noopener"&gt;https://community.fabric.microsoft.com/t5/Fabric-Updates-Blog/Fabric-Connection-inside-Notebook-Preview/ba-p/5172356&lt;/A&gt;&lt;/P&gt;&lt;P&gt;6. Create a pyspark-notebook (or modify existing one) and add the connection you created to the notebook&lt;/P&gt;&lt;P&gt;7. Add the template code for using the connection (Add as code cell, the previous link shows you what to do here)&lt;/P&gt;&lt;P&gt;8. After&amp;nbsp;&lt;FONT face="courier new,courier"&gt;cursor = conn.cursor()&lt;/FONT&gt;&amp;nbsp;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;, execute the Warehouse stored procedure with &lt;FONT face="courier new,courier"&gt;cursor.execute("SET NOCOUNT ON; exec &amp;lt;schema&amp;gt;.&amp;lt;procedure_name&amp;gt;")&lt;/FONT&gt; (SET NOCOUNT ON might not be needed in your case or it could be moved to the stored proedure itself)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;9. This is important. Add &lt;FONT face="courier new,courier"&gt;conn.commit()&lt;/FONT&gt; after the previous command. Without this the rows which are inserted inside the stored procedure are not saved to the Warehouse&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;10. Remove all the unnecessary code until &lt;FONT face="courier new,courier"&gt;cursor.close()&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is way more cumbersome than it needs to be, especially on a platform that should integrate all the necessary pieces to a uniform experience. Maybe there's another way, but I just couldn't figure it out.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jul 2026 10:33:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Fabric-Using-a-notebook-and-SQL-to-orchestrate-data-loads-from/m-p/5310530#M17338</guid>
      <dc:creator>NamelessLw</dc:creator>
      <dc:date>2026-07-21T10:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: Fabric: Using a notebook (and SQL) to orchestrate data loads from Lakehouse to Warehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Fabric-Using-a-notebook-and-SQL-to-orchestrate-data-loads-from/m-p/5311256#M17344</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/1366071"&gt;@NamelessLw&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for sharing your solution. Using a Stored Procedure in the Warehouse with Workspace Identity is a solid approach when you want to avoid Pipelines/Dataflows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another option you can try is using the `COPY INTO` SQL statement directly in the notebook. It can load data from Lakehouse tables into Warehouse tables without reading into a dataframe first.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jul 2026 15:57:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Fabric-Using-a-notebook-and-SQL-to-orchestrate-data-loads-from/m-p/5311256#M17344</guid>
      <dc:creator>Areeshabaloch7</dc:creator>
      <dc:date>2026-07-21T15:57:41Z</dc:date>
    </item>
    <item>
      <title>Re: Fabric: Using a notebook (and SQL) to orchestrate data loads from Lakehouse to Warehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Fabric-Using-a-notebook-and-SQL-to-orchestrate-data-loads-from/m-p/5311367#M17345</link>
      <description>&lt;P&gt;Thanks for sharing this detailed walkthrough—it’s a useful pattern for anyone who prefers to keep the transformation logic in &lt;STRONG&gt;T-SQL&lt;/STRONG&gt; while using a notebook only for orchestration.&lt;/P&gt;&lt;P&gt;Using a &lt;STRONG&gt;Workspace Identity&lt;/STRONG&gt; together with a &lt;STRONG&gt;Warehouse stored procedure&lt;/STRONG&gt; is a good approach when:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Your business logic is already implemented in T-SQL.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;You want to centralize transformation logic in the Warehouse.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;The notebook's primary role is orchestration rather than data transformation.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;One additional point worth mentioning is that &lt;STRONG&gt;conn.commit() is essential&lt;/STRONG&gt; when using the SQL connection from a notebook. Without it, the stored procedure may execute successfully, but any DML operations (such as INSERT, UPDATE, or MERGE) won't be persisted if the connection is operating within a transaction.&lt;/P&gt;&lt;P&gt;For others considering this approach, it's also worth evaluating whether:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;A &lt;STRONG&gt;Fabric Data Pipeline&lt;/STRONG&gt; is more appropriate if the primary requirement is scheduling and orchestration.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;A &lt;STRONG&gt;Notebook&lt;/STRONG&gt; is preferable when orchestration needs to be combined with Spark processing, Python logic, or other notebook-based tasks.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;A &lt;STRONG&gt;Stored Procedure&lt;/STRONG&gt; is the best place for business transformations that are naturally expressed in SQL and need to be reusable outside the notebook.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Overall, this is a solid example of combining Fabric components while keeping SQL at the center of the transformation process.&lt;/P&gt;&lt;P&gt;For more information, see:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Workspace Identity:&lt;/STRONG&gt; &lt;A href="https://learn.microsoft.com/fabric/security/workspace-identity" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/fabric/security/workspace-identity&lt;/A&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;SQL granular permissions in Fabric Warehouse:&lt;/STRONG&gt; &lt;A href="https://learn.microsoft.com/fabric/data-warehouse/sql-granular-permissions" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/fabric/data-warehouse/sql-granular-permissions&lt;/A&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Fabric Connections in Notebooks:&lt;/STRONG&gt; &lt;A href="https://learn.microsoft.com/fabric/data-engineering/how-to-use-fabric-data-connections-in-notebook" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/fabric/data-engineering/how-to-use-fabric-data-connections-in-notebook&lt;/A&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Stored procedures in Fabric Warehouse:&lt;/STRONG&gt; &lt;A href="https://learn.microsoft.com/fabric/data-warehouse/tsql-surface-area#stored-procedures" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/fabric/data-warehouse/tsql-surface-area#stored-procedures&lt;/A&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;H4&gt;&lt;STRONG&gt;&lt;span class="lia-unicode-emoji" title=":light_bulb:"&gt;💡&lt;/span&gt; Helpful? Give a Kudos &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt; — keep the community growing.&lt;/STRONG&gt;&lt;/H4&gt;&lt;H4&gt;&amp;nbsp;&lt;/H4&gt;</description>
      <pubDate>Tue, 21 Jul 2026 16:38:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Fabric-Using-a-notebook-and-SQL-to-orchestrate-data-loads-from/m-p/5311367#M17345</guid>
      <dc:creator>Prince0011</dc:creator>
      <dc:date>2026-07-21T16:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: Fabric: Using a notebook (and SQL) to orchestrate data loads from Lakehouse to Warehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Fabric-Using-a-notebook-and-SQL-to-orchestrate-data-loads-from/m-p/5311789#M17350</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/1366071"&gt;@NamelessLw&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I would also like to point out is that you could use the three part naming convention to query from your lakehouse to your warehouse.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As in the example below I'm in my warehouse and querying a lake house table.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GilbertQ_0-1784671598458.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1356478iC996ED5DCCC9F23A/image-size/large?v=v2&amp;amp;px=999" role="button" title="GilbertQ_0-1784671598458.png" alt="GilbertQ_0-1784671598458.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jul 2026 22:06:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Fabric-Using-a-notebook-and-SQL-to-orchestrate-data-loads-from/m-p/5311789#M17350</guid>
      <dc:creator>GilbertQ</dc:creator>
      <dc:date>2026-07-21T22:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: Fabric: Using a notebook (and SQL) to orchestrate data loads from Lakehouse to Warehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Fabric-Using-a-notebook-and-SQL-to-orchestrate-data-loads-from/m-p/5321835#M17403</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/1366071"&gt;@NamelessLw&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Could you review the suggestion provided above&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;and let us know if you have any additional questions, we are happy to address.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks!!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2026 05:19:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Fabric-Using-a-notebook-and-SQL-to-orchestrate-data-loads-from/m-p/5321835#M17403</guid>
      <dc:creator>v-sathmakuri</dc:creator>
      <dc:date>2026-07-27T05:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: Fabric: Using a notebook (and SQL) to orchestrate data loads from Lakehouse to Warehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Fabric-Using-a-notebook-and-SQL-to-orchestrate-data-loads-from/m-p/5330261#M17452</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/1366071"&gt;@NamelessLw&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please review the suggestion provided above and let us know if you still have any further questions?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2026 11:37:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Fabric-Using-a-notebook-and-SQL-to-orchestrate-data-loads-from/m-p/5330261#M17452</guid>
      <dc:creator>v-sathmakuri</dc:creator>
      <dc:date>2026-07-30T11:37:13Z</dc:date>
    </item>
    <item>
      <title>Re: Fabric: Using a notebook (and SQL) to orchestrate data loads from Lakehouse to Warehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Fabric-Using-a-notebook-and-SQL-to-orchestrate-data-loads-from/m-p/5342263#M17500</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P class=""&gt;Nice find! The tip is especially valuable. This should help &lt;A href="https://pizzahutmenu.co/" target="_self"&gt;anyone&lt;/A&gt; wanting to keep most of their Fabric transformations in SQL instead of PySpark.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 05 Aug 2026 04:23:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Fabric-Using-a-notebook-and-SQL-to-orchestrate-data-loads-from/m-p/5342263#M17500</guid>
      <dc:creator>carter_gray705</dc:creator>
      <dc:date>2026-08-05T04:23:45Z</dc:date>
    </item>
  </channel>
</rss>

