Skip to content

Commit 8ea3ad5

Browse files
authored
Merge pull request #85 from MicrosoftCloudEssentials-LearningHub/dynamic-notebook-pipeline
Passing Parameters to a Notebook from a Pipeline - Quick Guide
2 parents ac5b17d + 5d9cc2b commit 8ea3ad5

1 file changed

Lines changed: 113 additions & 0 deletions

File tree

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Passing Parameters to a Notebook from a Pipeline - Quick Guide
2+
3+
Costa Rica
4+
5+
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
6+
[brown9804](https://github.com/brown9804)
7+
8+
Last updated: 2025-03-03
9+
10+
----------
11+
12+
<details>
13+
<summary><b>List of References </b> (Click to expand)</summary>
14+
15+
- [What is Azure Data Factory?](https://learn.microsoft.com/en-us/azure/data-factory/introduction)
16+
- [Quickstart: Get started with Azure Data Factory](https://learn.microsoft.com/en-us/azure/data-factory/quickstart-get-started)
17+
- [Quickstart: Create a data factory by using the Azure portal](https://learn.microsoft.com/en-us/azure/data-factory/quickstart-create-data-factory)
18+
19+
</details>
20+
21+
## Content
22+
23+
- [Create a Microsoft Fabric Workspace](#create-a-microsoft-fabric-workspace)
24+
- [Create a Notebook with Parameters](#create-a-notebook-with-parameters)
25+
- [Using the Notebook in a Pipeline](#using-the-notebook-in-a-pipeline)
26+
27+
## Create a Microsoft Fabric Workspace
28+
29+
1. **Sign in to Power BI**: Go to the Power BI Service and log in.
30+
2. **Create a New Workspace**:
31+
- From the navigation pane, select `Workspaces`.
32+
- Click on `+ New workspace`.
33+
34+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/34fca476-6799-49b9-a1ce-a04384415305" />
35+
36+
- In the `Create a workspace` pane, enter a name for your workspace.
37+
38+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/bf18ce14-bdf1-4c5a-a15d-54fe538dba02" />
39+
40+
- Expand the `Advanced` section and choose either the Fabric capacity or Trial license mode.
41+
- Select `Apply` to create and open the new workspace
42+
43+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/72789bb8-1e6f-4a34-b117-3127dc0e0eb8" />
44+
45+
## Create a Notebook with Parameters
46+
47+
1. Go to Your Workspace:
48+
1. **Sign in to Power BI**: Go to the Power BI Service and log in.
49+
2. **Navigate to Workspaces**: From the navigation pane, select `Workspaces`.
50+
3. **Select Your Workspace**: Choose the workspace where you want to create the new item.
51+
2. Create a New Item
52+
1. **Click on New Item**: In your workspace, click on the `New item` button.
53+
2. **Choose the Item Type**: From the list of item types, select `Notebook`.
54+
55+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/c281bc81-7592-4f51-a4f5-20201cee2c70" />
56+
57+
3. Create and Configure the Notebook
58+
1. **Provide a Name**: Enter a name for your new notebook.
59+
2. **Configure the Notebook**: You can configure various settings for your notebook, such as the language (e.g., Python, Scala) and the environment.
60+
61+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/c9f4778c-4a64-4275-bdcd-24394484c908" />
62+
63+
4. Define Parameters in the Notebook
64+
1. **Open the Notebook**: Once the notebook is created, open it.
65+
2. **Define Parameters**: Add a cell to define the parameters you want to pass. For example:
66+
67+
```python
68+
# Parameters
69+
file_path = "abfss://<your-container-name>@<your-storage-account-name>.dfs.core.windows.net/<your-bronze-lakehousename>.Lakehouse/Tables/<table name>"
70+
token = ""
71+
```
72+
5. **Mark as Parameter Cell**: Select the `Toggle Parameter Cell` option to mark the cell as a parameter cell
73+
74+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/540fa3cc-a896-41b5-a144-81955e130a67" />
75+
76+
6. Save and Use the Notebook
77+
1. **Save the Notebook**: Save your notebook to ensure all changes are applied.
78+
2. **Use the Notebook in a Pipeline**: You can now use this notebook in a pipeline and pass parameters to it as needed.
79+
80+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/1cf3afe3-8f74-4e1a-a1fe-e9d30418737e" />
81+
82+
## Using the Notebook in a Pipeline
83+
84+
1. **Open the Notebook**: Navigate to the notebook you created in your Microsoft Fabric workspace.
85+
2. **Go to the Run Tab**: In the notebook view, click on the `Run` tab at the top of the page.
86+
3. **Add to Pipeline**: Under the `Run*` tab, select the `Add to pipeline` option. This will allow you to add the notebook to a new or existing pipeline.
87+
1. **Create a New Pipeline**: If you don't have an existing pipeline, you can create a new one by providing a name and selecting **Create**.
88+
2. **Select an Existing Pipeline**: If you already have a pipeline, select it from the list of available pipelines.
89+
90+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/10037c04-2608-418c-9d26-cf1dafa5835c" />
91+
92+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/f99bdef2-25ac-474b-b164-90366696694a" />
93+
94+
4. Configure the Notebook Activity
95+
1. **Open Pipeline Editor**: Once the notebook is added to the pipeline, the pipeline editor will open.
96+
97+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/6b8dc57f-a228-417b-a2b6-ecb2410443cb" />
98+
99+
2. **Select the Notebook Activity**: Click on the `Notebook activity` that was added to the pipeline.
100+
3. **Configure Parameters**: In the `Settings` tab of the `Notebook activity`, find the `Parameters` section. Add the parameters you want to pass to the notebook. Ensure the parameter names match the names defined in the notebook. For example:
101+
```json
102+
{
103+
"file_path": "/path/to/your/file",
104+
"token": "your_token_here"
105+
}
106+
```
107+
108+
https://github.com/user-attachments/assets/67c12ca6-0392-4313-9836-63ae6300154d
109+
110+
<div align="center">
111+
<h3 style="color: #4CAF50;">Total Visitors</h3>
112+
<img src="https://profile-counter.glitch.me/brown9804/count.svg" alt="Visitor Count" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/>
113+
</div>

0 commit comments

Comments
 (0)