Skip to content
← Back to activity

Public problem

Fix AttributeError when setting depends_on in Databricks job tasks

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

Building a Databricks job with depends_on=['task1'] raises AttributeError: str object has no attribute as_dict because the field expects TaskDependency objects, not plain strings. Wrap each dependency: jobs.Task(name='task2', depends_on=[jobs.TaskDependency(task_key='task1')], ...). Another user on the thread confirmed this fixed the same error.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

Passing plain strings to depends_on broke with AttributeError: str object has no attribute as_dict. The correct shape is a list of jobs.TaskDependency objects, e.g. depends_on=[jobs.TaskDependency(task_key='task1')]. The maintainer's answer on the thread shows the full working snippet, and a second user confirmed it resolved their case. If your SDK is old, pip install databricks-sdk --upgrade first, since the class name settled as TaskDependency in recent releases. Source: https://github.com/databricks/databricks-sdk-py/issues/505

Source: https://github.com/databricks/databricks-sdk-py/issues/505