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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
tmjones2
Helper I
Helper I

Is the Lakehouse Connection in Notebooks Supposed to Update when you select a different Lakehouse?

Is this intended? I would assume if you pick a different lakehouse, it would automatically update so that anything you run in the notebook is on that lakehouse.

 

I also ran a little experiment, the only time it ever updates the database you're actually hitting is when you change the default lakehouse (or if you do a spark.sql(f"USE {some_lakehouse}")). Has it always worked this way? Seems like I've spent way too much time in the notebooks to have never noticed this...

 

tmjones2_0-1743159088374.png

 

 

Thanks.

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

Hi @tmjones2 ,

Yes, this is actually the expected behavior in Fabric notebooks. When you select a different Lakehouse in the UI, it doesn’t automatically update the active connection in the notebook. Instead, the notebook sticks to the Lakehouse it was originally connected to unless you explicitly change it.

The likely reason behind it is to prevent disruptions if you're running a long session, switching the Lakehouse in the UI won’t suddenly reroute your queries and cause unintended issues. The notebook kernel maintains its own session state, so even though the UI makes it seem like the Lakehouse should change, the actual connection remains the same.

To make sure you're querying the right Lakehouse, you can:

  1. Set the default Lakehouse – This ensures the correct one is used when you restart the session.

  2. Explicitly switch Lakehouses in SQL – As you mentioned, running:
    spark.sql(f"USE {some_lakehouse}")

    will point your session to the correct Lakehouse.

It’s easy to overlook this since the UI makes it seem like selecting a new Lakehouse should apply everywhere, but the notebook maintains its own connection. A best practice is to always set the Lakehouse explicitly in your notebook if you're switching.

For more details, check out these resources:

Hope this helps! Let us know if you have any other questions.

 

If this post helps, then please consider "Accept it as the solution" to help the other members find it more quickly and a kudos would be appreciated.

Best Regards,
Vinay.

View solution in original post

4 REPLIES 4
v-veshwara-msft
Community Support
Community Support

Hi @tmjones2 ,

We’re following up once more regarding your query. If it has been resolved, please mark the helpful reply as the Accepted Solution to assist others facing similar challenges.

If you still need assistance, please let us know.
Thank you.

v-veshwara-msft
Community Support
Community Support

Hi @tmjones2 ,

Just checking in to see if you query is resolved and if any responses were helpful. If so, kindly consider marking the helpful reply as 'Accepted Solution' to help others with similar queries. 

Otherwise, feel free to reach out for further assistance.

Thank you.

v-veshwara-msft
Community Support
Community Support

Hi @tmjones2 ,

Following up to see if your query has been resolved. If so, please consider marking the helpful response as the Accepted Solution to assist others with similar issues. If you still need assistance, feel free to reach out.

Thank you!

v-veshwara-msft
Community Support
Community Support

Hi @tmjones2 ,

Yes, this is actually the expected behavior in Fabric notebooks. When you select a different Lakehouse in the UI, it doesn’t automatically update the active connection in the notebook. Instead, the notebook sticks to the Lakehouse it was originally connected to unless you explicitly change it.

The likely reason behind it is to prevent disruptions if you're running a long session, switching the Lakehouse in the UI won’t suddenly reroute your queries and cause unintended issues. The notebook kernel maintains its own session state, so even though the UI makes it seem like the Lakehouse should change, the actual connection remains the same.

To make sure you're querying the right Lakehouse, you can:

  1. Set the default Lakehouse – This ensures the correct one is used when you restart the session.

  2. Explicitly switch Lakehouses in SQL – As you mentioned, running:
    spark.sql(f"USE {some_lakehouse}")

    will point your session to the correct Lakehouse.

It’s easy to overlook this since the UI makes it seem like selecting a new Lakehouse should apply everywhere, but the notebook maintains its own connection. A best practice is to always set the Lakehouse explicitly in your notebook if you're switching.

For more details, check out these resources:

Hope this helps! Let us know if you have any other questions.

 

If this post helps, then please consider "Accept it as the solution" to help the other members find it more quickly and a kudos would be appreciated.

Best Regards,
Vinay.

Helpful resources

Announcements
December Fabric Update Carousel

Fabric Monthly Update - December 2025

Check out the December 2025 Fabric Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.