<?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 variable from one notebook to another in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/pass-variable-from-one-notebook-to-another/m-p/165400#M55434</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/115023"&gt;@ADB0513&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;With &lt;STRONG&gt;%run&lt;/STRONG&gt;, you dont need to pass anything. &lt;STRONG&gt;%run&lt;/STRONG&gt; runs the child inline in the same Python namespace, so the catalog variable set in the main notebook is already visible in the child. Just use it.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;# main
catalog = "dev_catalog"
# %run ./child_notebook

# child — catalog is already in scope; no widget, no config
spark.sql(f"INSERT INTO `{catalog}`.target_schema.target_table "
          f"SELECT * FROM `{catalog}`.source_schema.source_table")&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;Regarding your other concerns:&lt;BR /&gt;- Do NOT use &lt;STRONG&gt;spark.conf&lt;/STRONG&gt; for this because on serverless a custom key errors outright.&amp;nbsp;&lt;BR /&gt;- Use a widget + dbutils.notebook.run() only if the child must be reusable / isolated (a real orchestration step), not for a plain %run helper.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Aug 2026 17:52:31 GMT</pubDate>
    <dc:creator>adnan_alvee</dc:creator>
    <dc:date>2026-08-11T17:52:31Z</dc:date>
    <item>
      <title>Pass variable from one notebook to another</title>
      <link>https://community.databricks.com/t5/data-engineering/pass-variable-from-one-notebook-to-another/m-p/82066#M36502</link>
      <description>&lt;P&gt;I have a main notebook where I am setting a python variable to the name of the catalog I want to work in.&amp;nbsp; I then call another notebook, using %run, which runs an insert into using a SQL command where I want to specify the catalog using the catalog variable from the main notebook.&amp;nbsp; What is the best way to accomplish this?&amp;nbsp; Is there a way to pass the variable to the notebook that is being called from the %run command?&amp;nbsp; Should I use a widget?&amp;nbsp; Should I use spark.conf?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for the help.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 15:23:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pass-variable-from-one-notebook-to-another/m-p/82066#M36502</guid>
      <dc:creator>ADB0513</dc:creator>
      <dc:date>2024-08-06T15:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: Pass variable from one notebook to another</title>
      <link>https://community.databricks.com/t5/data-engineering/pass-variable-from-one-notebook-to-another/m-p/82337#M36613</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/115023"&gt;@ADB0513&lt;/a&gt;,&amp;nbsp;To pass variables between notebooks in Databricks, you can use three main methods: **Widgets**, where you create and retrieve parameters using `dbutils.widgets` in both notebooks; **spark.conf**, where you set and get configuration parameters; and **Global Variables**, which are less recommended due to scope issues. Widgets and `spark.conf` are generally more robust and maintainable, especially for CI/CD setups.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Would you like more details on any of these methods? Or do you have any other questions about your CI/CD setup with Databricks Asset Bundles?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 08:07:09 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pass-variable-from-one-notebook-to-another/m-p/82337#M36613</guid>
      <dc:creator>Retired_mod</dc:creator>
      <dc:date>2024-08-08T08:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: Pass variable from one notebook to another</title>
      <link>https://community.databricks.com/t5/data-engineering/pass-variable-from-one-notebook-to-another/m-p/165397#M55433</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/9"&gt;@Retired_mod&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;yes, it would be great to get more details on any of these methods. I am trying to do something similar too. Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2026 16:27:12 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pass-variable-from-one-notebook-to-another/m-p/165397#M55433</guid>
      <dc:creator>N_N</dc:creator>
      <dc:date>2026-08-11T16:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: Pass variable from one notebook to another</title>
      <link>https://community.databricks.com/t5/data-engineering/pass-variable-from-one-notebook-to-another/m-p/165400#M55434</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/115023"&gt;@ADB0513&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;With &lt;STRONG&gt;%run&lt;/STRONG&gt;, you dont need to pass anything. &lt;STRONG&gt;%run&lt;/STRONG&gt; runs the child inline in the same Python namespace, so the catalog variable set in the main notebook is already visible in the child. Just use it.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;# main
catalog = "dev_catalog"
# %run ./child_notebook

# child — catalog is already in scope; no widget, no config
spark.sql(f"INSERT INTO `{catalog}`.target_schema.target_table "
          f"SELECT * FROM `{catalog}`.source_schema.source_table")&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;Regarding your other concerns:&lt;BR /&gt;- Do NOT use &lt;STRONG&gt;spark.conf&lt;/STRONG&gt; for this because on serverless a custom key errors outright.&amp;nbsp;&lt;BR /&gt;- Use a widget + dbutils.notebook.run() only if the child must be reusable / isolated (a real orchestration step), not for a plain %run helper.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2026 17:52:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/pass-variable-from-one-notebook-to-another/m-p/165400#M55434</guid>
      <dc:creator>adnan_alvee</dc:creator>
      <dc:date>2026-08-11T17:52:31Z</dc:date>
    </item>
  </channel>
</rss>

