Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2025 11:17 AM
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)}."
)