<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Databricks -Terraform- (condition_task) in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/databricks-terraform-condition-task/m-p/75975#M35121</link>
    <description>&lt;P&gt;Hi Kaniz,&lt;/P&gt;&lt;P&gt;Thank you for replying back to my request. Yes I am consolidating all table record counts using notebook task (Task A) and passing 'Total_rec_counts' to condition_task (Task B) . It validate the 'Total_rec_counts' and decide to run DLT pipeline.&amp;nbsp;&lt;/P&gt;&lt;P&gt;code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;dynamic "task" {
  for_each = var.map_of_tables
  content {
    task_key = "${var.env}_validate_total_rec_count_${lower(task.key)}"
    run_if = "ALL_SUCCESS"
    depends_on{
      Task_keY="${var.env}_get_total_rec_count_${lower(task.key)}" # Task to get the record counts
    }

    condition_task {
      left = "{{tasks.${var.env}_get_total_rec_count_${lower(task.key)}.values.total_rec_count}}"
      op = "GREATER_THAN"
      right = 0
    }
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Error&lt;/STRONG&gt;&amp;nbsp;:-&amp;nbsp; it is not able to identify left operand&lt;/P&gt;&lt;P&gt;Error: cannot update job: The "left" operand of the if/else condition alid reference. Invalid reference: '{{tasks.env-HLQ_UNIT_TEST_get_total_rec_count.values.total_rec_count}}'. '{{tasks.env-HLQ_UNIT_TEST_get_total_rec_count.values.total_rec_count}}' is unknown.&lt;/P&gt;&lt;P&gt;please suggest how to fix it . My dependency syntax is little different than yours. The syntax you proposed was giving error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Jun 2024 21:58:41 GMT</pubDate>
    <dc:creator>RajaPalukuri</dc:creator>
    <dc:date>2024-06-27T21:58:41Z</dc:date>
    <item>
      <title>Databricks -Terraform- (condition_task)</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-terraform-condition-task/m-p/75357#M34948</link>
      <description>&lt;P&gt;Hi Team ,&lt;/P&gt;&lt;P&gt;I am planning to create IF/ELSE condition task in databricks using terraform code . My requirement is&amp;nbsp;&lt;/P&gt;&lt;P&gt;Task A ( Extract records from DB and Count recs) --&amp;gt; Task B ( validate the counts using Condition_task) --&amp;gt; Task c ( load data if Task B validate the counts &amp;gt;0)&lt;/P&gt;&lt;P&gt;I am able to implement it in databricks manually but trying to implement the same using Terraform code . Could you please help with this coditional task in data bricks . How can i refer "Total_record_counts' set in the task A is refered&amp;nbsp; in Task b using condition task.&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;following sample code.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;dynamic "task"{&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;for_each = var.map_of_tables # this is map variable of tables&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;content {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;task_key = "${var.env}_validate_total_rec_count_${lower(task.key)}"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;run_if = "ALL_SUCCESS"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;depends_on{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;task_key = "${var.env}_get_total_rec_count_${lower(task.key)}"&amp;nbsp; &amp;nbsp;-- Task to get the record counts&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;condition_task {&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;# conditional task&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; left = "{{tasks.${var.env}_get_total_rec_count_${lower(task.key)}.values.total_rec_count}}"&amp;nbsp; &amp;nbsp;&lt;STRONG&gt; # facing issue with this how can i refer variable which was set in predecessor notebook task&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; op = "GREATER_THAN"&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; right = 0&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;&lt;/DIV&gt;&lt;P&gt;Any help with sample code will be helpful&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2024 14:56:14 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-terraform-condition-task/m-p/75357#M34948</guid>
      <dc:creator>RajaPalukuri</dc:creator>
      <dc:date>2024-06-21T14:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks -Terraform- (condition_task)</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-terraform-condition-task/m-p/75975#M35121</link>
      <description>&lt;P&gt;Hi Kaniz,&lt;/P&gt;&lt;P&gt;Thank you for replying back to my request. Yes I am consolidating all table record counts using notebook task (Task A) and passing 'Total_rec_counts' to condition_task (Task B) . It validate the 'Total_rec_counts' and decide to run DLT pipeline.&amp;nbsp;&lt;/P&gt;&lt;P&gt;code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;dynamic "task" {
  for_each = var.map_of_tables
  content {
    task_key = "${var.env}_validate_total_rec_count_${lower(task.key)}"
    run_if = "ALL_SUCCESS"
    depends_on{
      Task_keY="${var.env}_get_total_rec_count_${lower(task.key)}" # Task to get the record counts
    }

    condition_task {
      left = "{{tasks.${var.env}_get_total_rec_count_${lower(task.key)}.values.total_rec_count}}"
      op = "GREATER_THAN"
      right = 0
    }
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Error&lt;/STRONG&gt;&amp;nbsp;:-&amp;nbsp; it is not able to identify left operand&lt;/P&gt;&lt;P&gt;Error: cannot update job: The "left" operand of the if/else condition alid reference. Invalid reference: '{{tasks.env-HLQ_UNIT_TEST_get_total_rec_count.values.total_rec_count}}'. '{{tasks.env-HLQ_UNIT_TEST_get_total_rec_count.values.total_rec_count}}' is unknown.&lt;/P&gt;&lt;P&gt;please suggest how to fix it . My dependency syntax is little different than yours. The syntax you proposed was giving error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2024 21:58:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-terraform-condition-task/m-p/75975#M35121</guid>
      <dc:creator>RajaPalukuri</dc:creator>
      <dc:date>2024-06-27T21:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks -Terraform- (condition_task)</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-terraform-condition-task/m-p/76116#M35152</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi Kaniz,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;To give you more details above request , In task A where we consolidate all tables records counts we are doing it through notebook task through python program. ''&lt;SPAN&gt;Total_rec_counts' , is out put variable which is set in python program . How could we refer it in the validation task in Terraform ?.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;There is anyway we can create output variable in TASK A in terraform and refer in TASK B ?. If so how to define the output variable in Terraform in TASK A&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 17:50:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-terraform-condition-task/m-p/76116#M35152</guid>
      <dc:creator>RajaPalukuri</dc:creator>
      <dc:date>2024-06-28T17:50:51Z</dc:date>
    </item>
  </channel>
</rss>

