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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
stuckerj
Frequent Visitor

REST API vs. Notebookutils Lakehouse Update Issue

REST API vs. Notebookutils Lakehouse Update Issue

Problem Summary

I am automating notebook provisioning in Microsoft Fabric and need to programmatically set or update the default Lakehouse for a notebook. I have tried both the REST API and the built-in Fabric Python SDK (notebookutils.notebook.updateDefinition). My findings:


1. REST API (/updateDefinition)

Endpoint:

POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/notebooks/{notebookId}/updateDefinition

Payload Example:

{
  "name": "Notebook 1",
  "definition": {
    "format": "ipynb",
    "parts": [
      {
        "path": "generate_data.ipynb",
        "payload": "<BASE64>",
        "payloadType": "InlineBase64"
      }
    ]
  },
  "defaultLakehouse": "<lakehouse_id>"
}
  • I have tried all combinations of optional fields (defaultLakehouseWorkspace, workspaceId).
  • The API always returns 202 Accepted, never completing with 200 OK or 204 No Content, even after many retries (waiting several minutes).
  • The notebook appears in the workspace and /notebooks endpoints, but the lakehouse update never finalizes.
  • If I omit definition, I get 400 InvalidInput: The Definition field is required.

2. Manual UI

  • Setting the default Lakehouse for a notebook via the Fabric web portal UI works instantly and as expected.

3. Python SDK (notebookutils.notebook.updateDefinition)

Code Example (executed inside a Fabric notebook):

(notebookutils
    .notebook
    .updateDefinition(
        name = "Notebook 1",
        defaultLakehouse = "<lakehouse_id>"
        # workspaceId and defaultLakehouseWorkspace seem optional in SDK
    )
)
  • When run inside Notebook 2, I can successfully set the default Lakehouse for Notebook 1.
  • The update takes about 1 minute to propagate, but does complete.
  • I cannot update the default Lakehouse for the currently running notebook (Notebook 2) from inside itself—only for other notebooks.

4. Additional Findings

  • The SDK appears to use internal service calls or context not exposed to REST API users.
  • The REST API requires a full notebook definition, even for a simple lakehouse update.
  • Even with the correct payload, the REST API gets stuck in an async state and never completes.

5. Request for Support

  • Is updating a Fabric notebook’s default Lakehouse officially supported via REST API?
  • Is there a workaround, or plans to improve this API feature?
  • Can you confirm if the difference is due to internal context/session, or a limitation/bug in the public API?
2 REPLIES 2
v-achippa
Community Support
Community Support

Hi @stuckerj,

 

Thank you for reaching out to Microsoft Fabric Community.

 

Thank you for sharing the detailed analysis, yes there is a difference between the REST API and the notebookutils behavior.

At present, updating a notebook’s default Lakehouse is not fully supported through the public REST API. When an .ipynb payload is sent, the API accepts it, returns 202 Accepted but never completes the async update, this is a known product limitation.

The supported and working method is using notebookutils.notebook.updateDefinition from another notebook. It runs inside fabric with the correct context. If REST must be used then it requires a full .py notebook definition and still may not complete fully.

 

Thanks and regards,

Anjan Kumar Chippa

Thank you for confirming the limitation. 

As a workaround, I was thinking about creating another Notebook programmatically, for the purpose of setting data connections for other Notebooks in the pipeline.  It sounds like that's a solid option.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Fabric Update Carousel

Fabric Monthly Update - September 2025

Check out the September 2025 Fabric update to learn about new features.

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.