---
title: "Discussion on \"How to Attach a Default Lakehouse to a Notebook in Fabric\" | Hashnode"
description: "Discussion on \"How to Attach a Default Lakehouse to a Notebook in Fabric\". Programmatically defining the default lakehouse of a notebook"
url: "https://hashnode.com/posts/how-to-attach-a-default-lakehouse-to-a-notebook-in-fabric/66a16c7f0c3c7317c41e7fdb"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to Attach a Default Lakehouse to a Notebook in Fabric](https://fabric.guru/how-to-attach-a-default-lakehouse-to-a-notebook-in-fabric?utm_source=hashnode&utm_medium=feed)

Programmatically defining the default lakehouse of a notebook

Jul 24, 2024 · 3 min read · fabric.guru  
Updated Jul 26, 2024  
Read the article

-   [#microsoftfabric](https://hashnode.com/tag/microsoftfabric)
-   [#lakehouse](https://hashnode.com/tag/lakehouse)

## Written by

[Sandeep Pawar](https://hashnode.com/@PawarBI)

@PawarBI

  
[View profile](https://hashnode.com/@PawarBI)

Building Data Analytics and Data Science solutions using Microsoft Fabric | Principal PM, Microsoft Fabric CAT

Principal Program Manager, Microsoft Fabric CAT helping users and organizations build scalable, insightful, secure solutions. Blogs, opinions are my own and do not represent my employer.

## Responses 2

Markdown supported · ⌘↵ to post

[Michal](https://hashnode.com/@michal-mlaka)

[Oct 30, 2024](https://hashnode.com/posts/how-to-attach-a-default-lakehouse-to-a-notebook-in-fabric/66a16c7f0c3c7317c41e7fdb/comment/6721ef6f9bb48f52949303fe)

Hi Sandeep, thanks a lot. I have read both blogs. I am interested in what's your approach when promoting notebook to another environment (feature branch -> dev -> test -> prod). I do not like UI assignment of lakehouses, cause its then hardcoded in notebook metadata. :D I use configure to setup default lakehouse, but how to assign another one ? I am not sure about mounting it. cause you can not change it when moving to another stage.

Thanks

[Gelo Dosil](https://hashnode.com/@Gelouma)

[Aug 28, 2024](https://hashnode.com/posts/how-to-attach-a-default-lakehouse-to-a-notebook-in-fabric/66a16c7f0c3c7317c41e7fdb/comment/66cf20ac68d04ed37abe0402)

I believe I have found the solution. It is possible to parameterize %%configure like this

%%configure

{ "defaultLakehouse": { "name": { "parameterName": "defaultLakehouseName", "defaultValue": "FourthLakehouse" }, "id": { "parameterName": "defaultLakehouseId", "defaultValue": "773faa37-826f-4f9b-830f-e2a7a23e3903" } } }

I am using it to programmatically drop unnecessary tables in various lakehouses, but I also think I will use it to apply optimize, vacuum and vorder operations to tables. hope it helps

[Frithjof Vassbø](https://hashnode.com/@frithjof)

[Jul 25, 2024](https://hashnode.com/posts/how-to-attach-a-default-lakehouse-to-a-notebook-in-fabric/66a16c7f0c3c7317c41e7fdb/comment/66a221ae96271f659e5801a3)

Great blog!

I'm wondering, is it possible to switch the default Lakehouse multiple times within a Notebook run?

If I understand correctly, changing the default Lakehouse by using the '%% configure' approach will only work properly if this is done in the first cell in the Notebook. I guess that means we can only set the default Lakehouse once in a Notebook run.

Some users want to be able to switch default Lakehouse programmatically multiple times within a Notebook run, in order to use Spark SQL on multiple Lakehouses within the same Notebook run.
