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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
AswanyT
Frequent Visitor

deploying .ipynb file from azure storage container to fabric notebook

Hi Team,

 

We are trying to deploy .ipynb file from our azure stoage container to fabric notebook via http request. We are able to create the notebook with name of blob that we have in container. But the content of ipynb blob file is not getting inside the fabric notebook. Below is the request that we are passing:

 

headers = {
                   "Authorization": "access_token",
                   "Content-type": "application/json"
                  }

# Your request payload
data = {
            "displayName": display_name,
            "type": "Notebook",
            "cells": [
            {
                "cell_type": "code",
                "source": [source_code],
                "execution_count": "null",
                "outputs": [],
                "metadata": {}
            }
        ],
        "metadata": {
                        "language_info": {
                        "name": "python"
                    },
        "trident": {
                        "environment": {
                        "workspaceId": "workspace_id"
                    },
                }
            }
       }
 
response = requests.post(url, headers=headers, json=data)
 
Getting response 202. fabric notebook with name display_name is getting created. 
 
Could you please help me on how to get the content of .ipynb file is also pass through the request and populate in the created notebook?
6 REPLIES 6
AswanyT
Frequent Visitor

Hi Team,

 

Any idea on how to do this?

Hi @AswanyT ,

Apologies for the issue you have been facing. I would like to check are you still facing this issue? 

It's difficult to tell what could be the reason for this performance. 

 

If the issue still persists, please reach out to our support team so they can do a more thorough investigation on why this it is happening: support-ticket-link.

 

After creating a Support ticket please provide the ticket number as it would help us to track for more information.

 

Hope this helps. Please let us know if you have any other queries.

Hi @AswanyT ,

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet .
In case if you have any resolution please do share that same with the community as it can be helpful to others .
If support ticket was created, please provide the ticket number as it would help us to track for more information.

Hi @AswanyT ,

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet .
In case if you have any resolution please do share that same with the community as it can be helpful to others .
If support ticket was created, please provide the ticket number as it would help us to track for more information.

v-gchenna-msft
Community Support
Community Support

Hi @AswanyT ,

Thanks for using Fabric Community.
As I understand you are trying to create fabric notebook using fabric rest api.
As a process of debugging can you please try to execute the API by hard coding the code in source field.

Manage and execute Fabric notebooks with public APIs - Microsoft Fabric | Microsoft Learn

vgchennamsft_0-1705643813078.png


Please let me know what is the response you are getting?

Thanks for the reply!

hardcoded the souce value and and still that aslo not coming in the created notebook. Below is the request:

data = {
                    "displayName": "notebook1",
                    "type": "Notebook",
                    "cells": [
                    {
                        "cell_type": "code",
                        "source": ["#Hello welcome"],
                        "execution_count": "null",
                        "outputs": [],
                        "metadata": {}
                    }
                ],
                "metadata": {
                                "language_info": {
                                "name": "python"
                            },
                "trident": {
                                "environment": {
                                "workspaceId": "workspace_id"
                            },
                        }
                    }

                }
 
I have my source code from .ipynb blob file in a varaible. wanted to pass this code to the created notebook. Blow is the code lines for reading source code from blob:
blob_client = container_client.get_blob_client(blob_name)
blob_content = blob_client.download_blob().readall().decode('utf-8-sig')
notebook_data = json.loads(blob_content)
# Extract the source code content from the notebook cells
source_code = "\n".join("\n".join(cell["source"]) for cell in notebook_data["cells"] if cell["cell_type"] == "code")
 
Thank you!

Helpful resources

Announcements
FabricCarousel_June2024

Fabric Monthly Update - June 2024

Check out the June 2024 Fabric update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.