<?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: Pass Notebook parameters dynamically in Job task. in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/pass-notebook-parameters-dynamically-in-job-task/m-p/130237#M48736</link>
    <description>&lt;P&gt;Thank you so much&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/110502"&gt;@szymon_dybczak&lt;/a&gt;&amp;nbsp;, it worked perfectly!. I'm also exploring the idea of maintaining a single notebook to pass parameters and reusing it across different jobs. Do you think that would be feasible with this approach, especially considering each notebook might require different parameters? I'd really appreciate any suggestions you might have.&lt;/P&gt;</description>
    <pubDate>Sat, 30 Aug 2025 14:50:20 GMT</pubDate>
    <dc:creator>Raj_DB</dc:creator>
    <dc:date>2025-08-30T14:50:20Z</dc:date>
    <item>
      <title>Pass Notebook parameters dynamically in Job task.</title>
      <link>https://community.databricks.com/t5/data-engineering/pass-notebook-parameters-dynamically-in-job-task/m-p/130017#M48671</link>
      <description>&lt;P&gt;Hi Everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm working on scheduling a job and would like to pass parameters that I've defined in my notebook. Ideally, I'd like these parameters to be dynamic meaning that if I update their values in the notebook, the scheduled job should automatically use the latest values. Is there a way to achieve this or any known workaround?&lt;/P&gt;&lt;P&gt;These are my parameters in notebook.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Raj_DB_0-1756383510542.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/19431i9F3ACF5FD39D4D1C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Raj_DB_0-1756383510542.png" alt="Raj_DB_0-1756383510542.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I am following all this parameter in all my notebook.&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Thu, 28 Aug 2025 12:39:00 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pass-notebook-parameters-dynamically-in-job-task/m-p/130017#M48671</guid>
      <dc:creator>Raj_DB</dc:creator>
      <dc:date>2025-08-28T12:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Pass Notebook parameters dynamically in Job task.</title>
      <link>https://community.databricks.com/t5/data-engineering/pass-notebook-parameters-dynamically-in-job-task/m-p/130019#M48672</link>
      <description>&lt;P&gt;Why not putting them extra code in notebook to handle job input parameters and then assign notebook default values based on some custom rule &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; As far as I know, no built-in feature to achieve your goal.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Aug 2025 12:50:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pass-notebook-parameters-dynamically-in-job-task/m-p/130019#M48672</guid>
      <dc:creator>Coffee77</dc:creator>
      <dc:date>2025-08-28T12:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: Pass Notebook parameters dynamically in Job task.</title>
      <link>https://community.databricks.com/t5/data-engineering/pass-notebook-parameters-dynamically-in-job-task/m-p/130041#M48675</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/177179"&gt;@Raj_DB&lt;/a&gt; &amp;nbsp;,&lt;/P&gt;&lt;P&gt;Yep, you just need to use task values. They&lt;SPAN&gt;&amp;nbsp;let you pass arbitrary values between tasks in a Databricks job.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So, for instance in your notebook you can define values you want to pass to your next job/task in following way.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="szymon_dybczak_0-1756393092383.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/19445iAB614D50CF7BD2CF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="szymon_dybczak_0-1756393092383.png" alt="szymon_dybczak_0-1756393092383.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Then in databricks workflow you can just past them to downstream job/task in following way. So, in above screenshot I defined catalog value that now I can pass to the job parameter:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;{{tasks.ReadConfig.values.catalog}} &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="szymon_dybczak_0-1756393527142.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/19447iE651AA3177B36B4F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="szymon_dybczak_0-1756393527142.png" alt="szymon_dybczak_0-1756393527142.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;A href="https://docs.databricks.com/aws/en/jobs/task-values" target="_blank" rel="noopener"&gt;Use task values to pass information between tasks | Databricks on AWS&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Aug 2025 15:05:50 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pass-notebook-parameters-dynamically-in-job-task/m-p/130041#M48675</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2025-08-28T15:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: Pass Notebook parameters dynamically in Job task.</title>
      <link>https://community.databricks.com/t5/data-engineering/pass-notebook-parameters-dynamically-in-job-task/m-p/130067#M48681</link>
      <description>&lt;P&gt;Nice&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Aug 2025 16:19:17 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pass-notebook-parameters-dynamically-in-job-task/m-p/130067#M48681</guid>
      <dc:creator>Coffee77</dc:creator>
      <dc:date>2025-08-28T16:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: Pass Notebook parameters dynamically in Job task.</title>
      <link>https://community.databricks.com/t5/data-engineering/pass-notebook-parameters-dynamically-in-job-task/m-p/130074#M48686</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/179536"&gt;@Coffee77&lt;/a&gt;&amp;nbsp;, Thank you for the response. Can you suggest me how to proceed? as I am new to this environment.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Aug 2025 17:02:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pass-notebook-parameters-dynamically-in-job-task/m-p/130074#M48686</guid>
      <dc:creator>Raj_DB</dc:creator>
      <dc:date>2025-08-28T17:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: Pass Notebook parameters dynamically in Job task.</title>
      <link>https://community.databricks.com/t5/data-engineering/pass-notebook-parameters-dynamically-in-job-task/m-p/130075#M48687</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/110502"&gt;@szymon_dybczak&lt;/a&gt;&amp;nbsp;, I will definitely try. I hope it will work.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Aug 2025 17:13:13 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pass-notebook-parameters-dynamically-in-job-task/m-p/130075#M48687</guid>
      <dc:creator>Raj_DB</dc:creator>
      <dc:date>2025-08-28T17:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: Pass Notebook parameters dynamically in Job task.</title>
      <link>https://community.databricks.com/t5/data-engineering/pass-notebook-parameters-dynamically-in-job-task/m-p/130076#M48688</link>
      <description>&lt;P&gt;No problem &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/177179"&gt;@Raj_DB&lt;/a&gt;&amp;nbsp;, it should work. I'm using this approach to dynamically pass parameters on the current project I'm part of &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Aug 2025 17:20:36 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pass-notebook-parameters-dynamically-in-job-task/m-p/130076#M48688</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2025-08-28T17:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: Pass Notebook parameters dynamically in Job task.</title>
      <link>https://community.databricks.com/t5/data-engineering/pass-notebook-parameters-dynamically-in-job-task/m-p/130081#M48691</link>
      <description>&lt;P class=""&gt;I see you're using dbutils.widgets. text and dropdown—perfect! You're already on the right track.&lt;/P&gt;&lt;H2&gt;Quick Solution&lt;/H2&gt;&lt;P class=""&gt;Your widgets are already dynamic! Just pass parameters in your job configuration:&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;In your notebook&lt;/STRONG&gt; (slight refactor of your code):&lt;/P&gt;&lt;P&gt;# Define widgets with defaults&lt;BR /&gt;dbutils.widgets.text("Month_refresh", "3")&lt;BR /&gt;dbutils.widgets.dropdown("Save_environment", "preprod", ["preprod", "prod"])&lt;BR /&gt;dbutils.widgets.dropdown("Save_Layer", "silver", ["bronze", "silver", "gold"])&lt;BR /&gt;dbutils.widgets.text("Save_folder", "Test/SalesData")&lt;/P&gt;&lt;P&gt;# Use the widget values&lt;BR /&gt;month = dbutils.widgets. get("Month_refresh")&lt;BR /&gt;env = dbutils.widgets.get("Save_environment")&lt;BR /&gt;layer = dbutils.widgets. get("Save_Layer")&lt;BR /&gt;folder = dbutils.widgets.get("Save_folder")&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;In your job configuration:&lt;/STRONG&gt;&lt;/P&gt;&lt;OL class=""&gt;&lt;LI&gt;Go to Workflows → Create Job&lt;/LI&gt;&lt;LI&gt;Add your notebook as a task&lt;/LI&gt;&lt;LI&gt;Under "Parameters," add:&lt;BR /&gt;{&lt;BR /&gt;"Month_refresh": "6",&lt;BR /&gt;"Save_environment": "prod",&lt;BR /&gt;"Save_Layer": "gold",&lt;BR /&gt;"Save_folder": "Prod/SalesData"}&lt;BR /&gt;&lt;P class=""&gt;These job parameters will override your notebook defaults!&lt;/P&gt;&lt;H2&gt;Pro Tip: Environment-based Defaults&lt;/H2&gt;&lt;P&gt;# Auto-detect environment&lt;BR /&gt;is_prod = spark.catalog.currentCatalog() == "prod_catalog"&lt;BR /&gt;default_env = "prod" if is_prod else "preprod"&lt;BR /&gt;default_layer = "gold" if is_prod else "silver"&lt;/P&gt;&lt;P&gt;dbutils.widgets.dropdown("Save_environment", default_env, ["preprod", "prod"])&lt;BR /&gt;dbutils.widgets.dropdown("Save_Layer", default_layer, ["bronze", "silver", "gold"])&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P class=""&gt;This way, your scheduled jobs automatically adapt to the environment they run in.&lt;/P&gt;&lt;P class=""&gt;Is this what you were looking for, or did you need the parameters to update without touching the job configuration?&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Thu, 28 Aug 2025 19:07:17 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pass-notebook-parameters-dynamically-in-job-task/m-p/130081#M48691</guid>
      <dc:creator>ck7007</dc:creator>
      <dc:date>2025-08-28T19:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: Pass Notebook parameters dynamically in Job task.</title>
      <link>https://community.databricks.com/t5/data-engineering/pass-notebook-parameters-dynamically-in-job-task/m-p/130096#M48694</link>
      <description>&lt;P&gt;That would work indeed &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; However, solution provided by &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/110502"&gt;@szymon_dybczak&lt;/a&gt;&amp;nbsp;is really clean &lt;span class="lia-unicode-emoji" title=":direct_hit:"&gt;🎯&lt;/span&gt; In your code if you have separated workspaces by environment, I would suggest to get current environment based on "current workspace" or "environment variables" injected in all "job" or "all-purpose" clusters where you can store your custom environment names. You can do this via DAB along with Databricks CLI scripts. Take into account that you can have multiple catalogs per environment as is my use case &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Aug 2025 20:23:01 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pass-notebook-parameters-dynamically-in-job-task/m-p/130096#M48694</guid>
      <dc:creator>Coffee77</dc:creator>
      <dc:date>2025-08-28T20:23:01Z</dc:date>
    </item>
    <item>
      <title>Re: Pass Notebook parameters dynamically in Job task.</title>
      <link>https://community.databricks.com/t5/data-engineering/pass-notebook-parameters-dynamically-in-job-task/m-p/130237#M48736</link>
      <description>&lt;P&gt;Thank you so much&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/110502"&gt;@szymon_dybczak&lt;/a&gt;&amp;nbsp;, it worked perfectly!. I'm also exploring the idea of maintaining a single notebook to pass parameters and reusing it across different jobs. Do you think that would be feasible with this approach, especially considering each notebook might require different parameters? I'd really appreciate any suggestions you might have.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Aug 2025 14:50:20 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pass-notebook-parameters-dynamically-in-job-task/m-p/130237#M48736</guid>
      <dc:creator>Raj_DB</dc:creator>
      <dc:date>2025-08-30T14:50:20Z</dc:date>
    </item>
  </channel>
</rss>

