Forum Discussion
How to set default Lakehouse in the notebook programmatically?
- Anonymous2 years ago
Hi keataunooi
Thanks for using Fabric Community.
To programmatically attach a lakehouse for a session level, you can use this below code in your notebook:# Welcome to your new notebook # Type here in the cell editor to add code! %%configure { "defaultLakehouse": { # This overwrites the default lakehouse for current session "name": "your-lakehouse-name", #"id": "<(optional) lakehouse-id>", #"workspaceId": "<(optional) workspace-id-that-contains-the-lakehouse>" # Add workspace ID if it's from another workspace } }
Hope this helps. Please let me know if you have any further questions.
Hi keataunooi
Thanks for using Fabric Community.
To programmatically attach a lakehouse for a session level, you can use this below code in your notebook:
# Welcome to your new notebook
# Type here in the cell editor to add code!
%%configure
{
"defaultLakehouse": { # This overwrites the default lakehouse for current session
"name": "your-lakehouse-name",
#"id": "<(optional) lakehouse-id>",
#"workspaceId": "<(optional) workspace-id-that-contains-the-lakehouse>" # Add workspace ID if it's from another workspace
}
}
Hope this helps. Please let me know if you have any further questions.
Hi Anonymous
If I have a Lakehouse with the same name both in Dev and in Prod workspaces, this code will attach the corresponding Lakehouse , if I do not specify Workspace ID ?
- srinivas11252 years agoNew Member
Even I have the same question. Does it attach lakehouse from the current workspace in case workspaceid is not mentioned?
And also does the notebook use other lakehouses of current workspace in SparkSQL ?