cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass parameters for jobs containing for_each_task

om_bk_00
New Contributor III
resources:
  jobs:
    X:
      name: X
      tasks:
        - task_key: X
          for_each_task:
            inputs: "{{job.parameters.input}}"
            task:
              task_key: X
              existing_cluster_id: ${var.my_cluster_id}
              spark_python_task:
                python_file: ../../src/shared/XX.py
      queue:
        enabled: true
      parameters:
        - name: input
          default: <How to format this correctly??>
for now all im getting is incorrect formatting errors.
 
when i do the same job but without the for each and inputs; the default value is a list or arguments that gets parsed
e.g ["--table_name=table1", "--table_schema=schema1"] ... 
 
resources:
  jobs:
    X:
      name: X
      max_concurrent_runs: 50
      tasks:
        - task_key: X
          existing_cluster_id: ${var.my_cluster_id}
          spark_python_task:
            python_file: ../../src/shared/XX.py
            parameters: ["--table_name=table1", "--table_schema=schema1"]
1 REPLY 1

NandiniN
Databricks Employee
Databricks Employee

To reference job parameters in the inputs field, use the syntax {{job.parameters.<name>}}.

Kindly refer to https://docs.databricks.com/en/jobs/for-each.html

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group