<?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: Recursive notebooks calls default lakehouse in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Recursive-notebooks-calls-default-lakehouse/m-p/4061660#M3277</link>
    <description>&lt;P&gt;Yes, I am using Spark SQL in Notebook B.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The point is that we need Notebook B to use its own default lakehouse, which it does when run individually but it does NOT when called from Notebook A.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As per your suggestion:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="maxkent_0-1721916655406.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1138958i4B572A48063D3881/image-size/medium?v=v2&amp;amp;px=400" role="button" title="maxkent_0-1721916655406.png" alt="maxkent_0-1721916655406.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;It seems that when you call from a notebook from another notebook, the &lt;STRONG&gt;default lakehouse&lt;/STRONG&gt; of the called notebook (Notebook B) is overwritten with the caller one (Notebook A). In the above screenshot there is none, as I wrote in the post itself, in our case has no default lakehouse.&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jul 2024 14:13:27 GMT</pubDate>
    <dc:creator>maxkent</dc:creator>
    <dc:date>2024-07-25T14:13:27Z</dc:date>
    <item>
      <title>Recursive notebooks calls default lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Recursive-notebooks-calls-default-lakehouse/m-p/4061368#M3273</link>
      <description>&lt;P&gt;We have the following notebooks:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Notebook A, with no default lakehouse&lt;/P&gt;&lt;P&gt;- Notebook B, with a default lakehouse&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it an expected scenario that when calling Notebook B from Notebook A, the default lakehouse is taken from Notebook A (in this case none)?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a matter of fact, while executing the scenario above, through&amp;nbsp;&lt;SPAN&gt;mssparkutils.notebook.run(),&amp;nbsp;&lt;/SPAN&gt;we get the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;AnalysisException: org.apache.hadoop.hive.ql.metadata.HiveException: MetaException(message:Spark SQL queries are only possible in the context of a lakehouse. Please attach a lakehouse to proceed.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2024 11:59:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Recursive-notebooks-calls-default-lakehouse/m-p/4061368#M3273</guid>
      <dc:creator>maxkent</dc:creator>
      <dc:date>2024-07-25T11:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive notebooks calls default lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Recursive-notebooks-calls-default-lakehouse/m-p/4061409#M3275</link>
      <description>&lt;P&gt;Are you using Spark SQL in Notebook A or Notebook B?&lt;/P&gt;&lt;P&gt;I think it is possible to use Spark SQL in a Notebook without having a default lakehouse.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Possibly a related thread:&amp;nbsp;&lt;A href="https://community.fabric.microsoft.com/t5/Data-Engineering/Mounting-NB-on-the-fly/m-p/4057128#M3222" target="_blank" rel="noopener"&gt;Mounting NB on- the-fly - Microsoft Fabric Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to examine the default lakehouse in a Notebook run, I think you can use &lt;SPAN&gt;mssparkutils.fs.mounts()&lt;/SPAN&gt;&amp;nbsp;inside the Notebook, and look for a lakehouse with scope = 'default_lh' and then look at the source path to identify which Lakehouse is the default lakehouse.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="frithjof_v_0-1721911960510.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1138885i457AA62C61079DA0/image-size/large?v=v2&amp;amp;px=999" role="button" title="frithjof_v_0-1721911960510.png" alt="frithjof_v_0-1721911960510.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2024 12:57:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Recursive-notebooks-calls-default-lakehouse/m-p/4061409#M3275</guid>
      <dc:creator>frithjof_v</dc:creator>
      <dc:date>2024-07-25T12:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive notebooks calls default lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Recursive-notebooks-calls-default-lakehouse/m-p/4061660#M3277</link>
      <description>&lt;P&gt;Yes, I am using Spark SQL in Notebook B.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The point is that we need Notebook B to use its own default lakehouse, which it does when run individually but it does NOT when called from Notebook A.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As per your suggestion:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="maxkent_0-1721916655406.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1138958i4B572A48063D3881/image-size/medium?v=v2&amp;amp;px=400" role="button" title="maxkent_0-1721916655406.png" alt="maxkent_0-1721916655406.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;It seems that when you call from a notebook from another notebook, the &lt;STRONG&gt;default lakehouse&lt;/STRONG&gt; of the called notebook (Notebook B) is overwritten with the caller one (Notebook A). In the above screenshot there is none, as I wrote in the post itself, in our case has no default lakehouse.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2024 14:13:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Recursive-notebooks-calls-default-lakehouse/m-p/4061660#M3277</guid>
      <dc:creator>maxkent</dc:creator>
      <dc:date>2024-07-25T14:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive notebooks calls default lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Recursive-notebooks-calls-default-lakehouse/m-p/4061845#M3282</link>
      <description>&lt;P&gt;Maybe it can work to use this code in the first cell in Notebook B?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;%%configure -f
{
    "defaultLakehouse": {  
        "name": "&amp;lt;lakehouseName&amp;gt;",
        "id": "&amp;lt;lakehouseID&amp;gt;",
        "workspaceId": "&amp;lt;workspaceID&amp;gt;"
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In order to try to force Notebook B to use this default Lakehouse, even when it's called from Notebook A.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(I don't have any knowledge regarding your question:&amp;nbsp;&lt;EM&gt;Is it an expected scenario that when calling Notebook B from Notebook A, the default lakehouse is taken from Notebook A (in this case none)?&lt;/EM&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope someone else can answer that.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe these articles are somehow relevant?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/fabric/data-engineering/configure-high-concurrency-session-notebooks#session-sharing-conditions" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/fabric/data-engineering/configure-high-concurrency-session-notebooks#session-sharing-conditions&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&lt;A href="https://fabric.guru/how-to-attach-a-default-lakehouse-to-a-notebook-in-fabric" target="_blank" rel="noopener"&gt;https://fabric.guru/how-to-attach-a-default-lakehouse-to-a-notebook-in-fabric&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I don't have experience with calling a notebook from another notebook.&lt;/P&gt;&lt;P&gt;So I hope someone else can answer&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Btw, I think you can run Spark SQL in Notebook B even if it doesn't have a default Lakehouse.&lt;/P&gt;&lt;P&gt;However I think it means you would need to use temporary views in your code. At least that worked for me. Ref. one of the last comments here:&amp;nbsp;&lt;A href="https://community.fabric.microsoft.com/t5/Data-Engineering/Mounting-NB-on-the-fly/m-p/4057128#M3222" target="_blank" rel="noopener"&gt;https://community.fabric.microsoft.com/t5/Data-Engineering/Mounting-NB-on-the-fly/m-p/4057128#M3222&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or you could maybe use plain PySpark (without using Spark SQL).&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2024 16:01:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Recursive-notebooks-calls-default-lakehouse/m-p/4061845#M3282</guid>
      <dc:creator>frithjof_v</dc:creator>
      <dc:date>2024-07-25T16:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive notebooks calls default lakehouse</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Recursive-notebooks-calls-default-lakehouse/m-p/4062863#M3293</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/780546"&gt;@maxkent&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the reply from &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/437984"&gt;@frithjof_v&lt;/a&gt;&amp;nbsp;. The code you provided is very good!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I created three Notebooks for testing, where Notebook6 and Notebook8 are associated with a lakehouse, while Notebook9 does not have a default lakehouse.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I call notebook8 in notebook6 it works fine and when I call notebook9 in notebook6 some error occurs.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;from notebookutils import mssparkutils

result = notebookutils.notebook.run("Notebook 9", 60)

display(result)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vhuijieymsft_0-1721973288537.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1139391i80634D27787D3970/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vhuijieymsft_0-1721973288537.png" alt="vhuijieymsft_0-1721973288537.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since Notebook A does not have a default lake bin in one piece, this context will be passed to Notebook B, resulting in the error you encountered.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the “%%configure” method frithjof_v&amp;nbsp;mentioned to set up lakehouse for the notebook.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also use the non-coding method in the screenshot below to assign a lakehouse context to the notebook.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vhuijieymsft_1-1721973288541.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1139390iD08CE40EF8857819/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vhuijieymsft_1-1721973288541.png" alt="vhuijieymsft_1-1721973288541.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can see that it runs well after assigning the lakehouse context.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vhuijieymsft_2-1721973297747.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1139393i8A88740E1DE72829/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vhuijieymsft_2-1721973297747.png" alt="vhuijieymsft_2-1721973297747.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have any other questions please feel free to contact me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Yang&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;BR /&gt;If I misunderstand your needs or you still have problems on it, please feel free to let us know.&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Thanks a lot!&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2024 05:56:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Recursive-notebooks-calls-default-lakehouse/m-p/4062863#M3293</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-07-26T05:56:53Z</dc:date>
    </item>
  </channel>
</rss>

