Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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...
Thanks.
Solved! Go to Solution.
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:
Set the default Lakehouse – This ensures the correct one is used when you restart the session.
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:
Connect lakehouses and notebooks: https://learn.microsoft.com/en-us/fabric/data-engineering/how-to-use-notebook#connect-lakehouses-and...
Programmatically Removing & Updating Default Lakehouse in a Notebook: https://fabric.guru/programmatically-removing-updating-default-lakehouse-of-a-fabric-notebook
Update attached Lakehouse using code: https://community.fabric.microsoft.com/t5/Data-Engineering/Update-Notebook-attached-lakehouse-using-...
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.
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.
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.
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!
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:
Set the default Lakehouse – This ensures the correct one is used when you restart the session.
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:
Connect lakehouses and notebooks: https://learn.microsoft.com/en-us/fabric/data-engineering/how-to-use-notebook#connect-lakehouses-and...
Programmatically Removing & Updating Default Lakehouse in a Notebook: https://fabric.guru/programmatically-removing-updating-default-lakehouse-of-a-fabric-notebook
Update attached Lakehouse using code: https://community.fabric.microsoft.com/t5/Data-Engineering/Update-Notebook-attached-lakehouse-using-...
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.