Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
ketankhunti
New Member

How to configure default Lakehouse in notebook in Fabric

I want to configure defualt laekhouse in notebook. i can do it using %%configure command. but i am note able to use variables here to be used in %%configure command. As configure should be the first cell of the notebook and if you put it in middle of the notebook then you have to force restart session, but problem is when i restart session, my variables will be erased.

ketankhunti_0-1734346304815.png

I also tried this, but getting this error

ketankhunti_1-1734346397449.png

How to resolve it. i also tried using mount, but that is also not working

 

1 ACCEPTED SOLUTION
v-jingzhan-msft
Community Support
Community Support

Hi @ketankhunti 

 

The configure magic has to be the first cell and be at the beginning of the first cell, so we can't programmatically assign the lakehouse id or name in the configure json via a variable or config file. This is the main obstacle.

 

Do you must set up the default lakehouse for the notebook? If not, you could try mounting a lakehouse to the notebook. Then you will be able to use the relative File API path to reference the tables and files in the lakehouse. This doesn't specify a default lakehouse. 

 

Another option is to use the ABFS path to reference a lakehouse. With ABFS path, you can always reference tables and files in a lakehouse correctly, without bothering whether it's the default lakehouse. 

 

The third link I listed below introduces a method to update the default lakehouse. I haven't tested that. You may give it a try. You might need to modify the default lakehouse for other notebooks with a new notebook.

 

References:

How to Attach a Default Lakehouse to a Notebook in Fabric

How To Mount A Lakehouse and Identify Mounted Lakehouses in Fabric

Programmatically Removing & Updating Default Lakehouse Of A Fabric Notebook

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

View solution in original post

1 REPLY 1
v-jingzhan-msft
Community Support
Community Support

Hi @ketankhunti 

 

The configure magic has to be the first cell and be at the beginning of the first cell, so we can't programmatically assign the lakehouse id or name in the configure json via a variable or config file. This is the main obstacle.

 

Do you must set up the default lakehouse for the notebook? If not, you could try mounting a lakehouse to the notebook. Then you will be able to use the relative File API path to reference the tables and files in the lakehouse. This doesn't specify a default lakehouse. 

 

Another option is to use the ABFS path to reference a lakehouse. With ABFS path, you can always reference tables and files in a lakehouse correctly, without bothering whether it's the default lakehouse. 

 

The third link I listed below introduces a method to update the default lakehouse. I haven't tested that. You may give it a try. You might need to modify the default lakehouse for other notebooks with a new notebook.

 

References:

How to Attach a Default Lakehouse to a Notebook in Fabric

How To Mount A Lakehouse and Identify Mounted Lakehouses in Fabric

Programmatically Removing & Updating Default Lakehouse Of A Fabric Notebook

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

JanFabricDE_carousel

Fabric Monthly Update - January 2025

Explore the power of Python Notebooks in Fabric!

JanFabricDW_carousel

Fabric Monthly Update - January 2025

Unlock the latest Fabric Data Warehouse upgrades!

JanFabricDF_carousel

Fabric Monthly Update - January 2025

Take your data replication to the next level with Fabric's latest updates!