iyashk-DB
Databricks Employee
Databricks Employee

Job/task parameters are free-form strings (or JSON) that get pushed down into tasks; there’s no built‑in way in Jobs to constrain them to an enum list like A/B/C in the UI or API. You can override them at run time, but they’re not validated against the widget choices.

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

# Validate against your curated list
allowed = {"A", "B", "C"}
if val not in allowed:
    # Fail fast (or coerce to a default) so job runs are clearly logged as invalid
    raise ValueError(
        f"Invalid value for 'My widget': {val}. Allowed values are {sorted(allowed)}."
    )

View solution in original post