Make Databricks operators' json
parameter compatible with XComs, Jinja expression values
#35433
Open
1 task done
Labels
Body
A few Databricks operators exist which have a
json
parameter that can be a JSON object which contains any number of API parameters. In the constructors of these operators, thejson
value can be added to be other parameters that can be passed to the operator likename
,tags
, etc.Since
json
is a templated field, attempting to modify it in this way will fail/not work as expected if the input arg is a string (e.g. "{{ var.json....}}" or an XComArg (meaning it's an output of a previous task). Template fields are not rendered until just before the execute method is called.To illustrate the point, let's use this example DAG where we define the
json
arg in a previous task and use its output:DAG parsing fails with:
Even if we change the
json
arg assignment to use the classic XCom Jinja template approach (i.e.json = "{{ ti.xcom_pull(task_ids='push_json') }}"
), the DAG fails to parse:It would be best to move modifying json (and generally any template field) to the execute method instead.
Currently this impacts the following operators:
Committer
The text was updated successfully, but these errors were encountered: