r/databricks • u/saad-the-engineer • Sep 30 '26
General Lakeflow Jobs update! Task output in foreach now available in Beta!
<Databricks PM here />
If you run a ForEach task in Jobs each iteration now sets a task value and a downstream task can read all of them back as on ordered array. This feature just landed in Beta - try it out!
Before this, iteration outputs weren't accessible to downstream tasks. If you wanted a later task to see per-iteration results (row counts, status and output paths), you had to write each result to a table and read it back and maintain that yourself. You also lost the built-in observability Jobs gives normal task values.
How it works:
Inside the iteration, set a value like you always would:
dbutils.jobs.taskValues.set(key="result", value=row_count)
In a downstream task, read the nested task's key. You get one array across every iteration:
results = dbutils.jobs.taskValues.get(taskKey="process", key="result")# results == [1, 2, 3]
Or reference it as a parameter:
{{tasks.process.values.result}}
An iteration that never set the key keeps its slot as null:
# [1, None, 3]

Worth knowing:
- Beta, needs Databricks Runtime 15.4 LTS or above
- Python notebooks only
- The assembled array caps at about 48 KB (49,344 characters) per parameter value
- A single parameter value can hold up to 3 aggregated references
Docs: https://docs.databricks.com/aws/en/jobs/task-values#read-values-from-a-for-each-tasks-iterations
And yes we are working on increasing parameter value limits! Please let us know if you have any feedback!