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

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now