cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to restrict the values permitted in a job or task parameter?

SRJDB
Visitor

Hi, apologies if this is a daft question - I'm relatively new to Databricks and still finding my feet!

I have a notebook with a parameter set within it via a widget, like this:

dbutils.widgets.dropdown("My widget", "A", ["A", "B", "C"])

my_variable = dbutils.widgets.get("My widget")

As you can see, the only options available to pick are 'A', 'B', and 'C'.I want to run this notebook through a job, so I can log runs. I want to set the value of my_variable through a job or task parameter in the job.

I know how to create a job or task parameter, and that the value this is set to can be picked up by widgets.get. However, I don't know how I can restrict the values that can be entered to 'A', 'B', and 'C'; there doesn't seem to be an option to do this.

Does anyone know how to do this please?

 

 

1 REPLY 1

Raman_Unifeye
Contributor III

Databricks Job/Task parameter interface does not provide a built-in UI feature to restrict the possible values entered by user. Yoou can add a runtime validation code inside the notebook to allow/fail based on the values entered in.


RG #Driving Business Outcomes with Data Intelligence

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now