03-13-2022 04:53 AM
I know the dbutils.widget.text to create a widget in a notebook. So for me the workflow
1. Having a notebook
2. Use dbutils.widget.text (or other type of widgets) once in a notebook cell to create a widget
3. Remove the cell containing dbutils.widget.text (because it's not usefull anymore)
4. Use dbutils.widget.get permanently in the notebook
Now I want to automate the following. I deploy a Jupyter notebook from a repo to a databricks workspace programmatically (using Azure devops). The deployment works fine using Databricks APIs, but only one thing is missing for me, the widget creation. Because manually creating the widget requires executing the cells with the widget.text call, how can I do that without having to run the cell manually, then remove it then come back to continue the deployment process.
04-17-2022 10:42 AM
03-14-2022 03:27 AM
@Mehdi BEN ABDESSELEM , Did you try to run the job with that notebook with API?
https://docs.databricks.com/dev-tools/api/latest/jobs.html#operation/JobsRunsSubmit -
Create and trigger a one-time run POST to https://<databricks-instance>/api/2.1/jobs/runs/submit
04-17-2022 10:50 AM
Good to know, thanks
04-17-2022 10:42 AM
04-17-2022 10:51 AM
Good to know, thanks. I wonder if updating a notebook (overwriting the notebook with the API), will also remove the widget or not
04-20-2022 01:50 PM
Hi @Mehdi BEN ABDESSELEM
What is the reason for removing the creation of the widget (e.g. dbutils.widget.text) in the notebook? You could leave it there with a proper default value and run the notebook if you need to. Also, if you do not want to see the code of the creation script, you could simply hide it.
Hope this helps, @Yves Mauron
04-21-2022 05:31 AM
The reason is I was concerned with the widget.text creation method would override the parameter sent through. But it seems it's not the case (even if I've seen some strange behavior with correctly spelt parameters not being recognized). Thank you indeed
04-27-2022 02:54 AM
Hi Fatma. There are enough information here. Most importantly, the widget creation instruction doesn't reinitialize the parameter which is passed.
07-14-2022 01:26 AM
@Mehdi BEN ABDESSELEM ,
Steps for Creating a Basic Widget
Step 1: Create a New Project
To create a new project in Android Studio, please refer to How to Create/Start a New Project in Android Studio. We are implementing it for both Java and Kotlin languages.
Step 2: Add the App Widget to the Project
Right-Click on the app, move the cursor to new, find the “Widget” option at the end, and select it.
Specify the required properties for the widget, such as min. Width and height, config file, and preferred language proceed. Files are automatically generated.
Step 3: Install and Run the Code
Install and Run the code on Android Virtual Device (AVD) or a personal device.
Open the widget section of the phone, lookup for a widget with the Application name, select it, and bring it to the home screen.
Try changing the dimensions, and we are done!
This may help you,
Rachel Gomez
Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.
If there isn’t a group near you, start one and help create a community that brings people together.
Request a New Group