<?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: how to list all spark session config variables in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-list-all-spark-session-config-variables/m-p/82427#M36647</link>
    <description>&lt;P&gt;A while back I think I found a way to get python to list all the config values.&amp;nbsp; I was not able to re-create it.&amp;nbsp; Just make one of your notebook code sections scala (first line) and use the second line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;%&lt;/SPAN&gt;&lt;SPAN&gt;scala&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;(spark.conf.getAll).foreach(println)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Thu, 08 Aug 2024 16:54:45 GMT</pubDate>
    <dc:creator>RyanHager</dc:creator>
    <dc:date>2024-08-08T16:54:45Z</dc:date>
    <item>
      <title>how to list all spark session config variables</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-list-all-spark-session-config-variables/m-p/41952#M27383</link>
      <description>&lt;P&gt;In databricks I can set a config variable at session level, but it is not found in the context variables:&lt;/P&gt;&lt;PRE&gt;spark.conf.&lt;SPAN class=""&gt;set&lt;/SPAN&gt;(&lt;SPAN class=""&gt;f"dataset.bookstore"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;'123'&lt;/SPAN&gt;) &lt;SPAN class=""&gt;#dataset_bookstore&lt;/SPAN&gt;
spark.conf.get(&lt;SPAN class=""&gt;f"dataset.bookstore"&lt;/SPAN&gt;)&lt;SPAN class=""&gt;#123&lt;/SPAN&gt;
scf = spark.sparkContext.getConf()
allc = scf.getAll()
scf.contains(&lt;SPAN class=""&gt;f"dataset.bookstore"&lt;/SPAN&gt;) &lt;SPAN class=""&gt;# False&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;I understand there is a difference between session and context-level config variables, how can I retrieve all session-level variables using&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;spark.conf?&lt;/P&gt;&lt;P&gt;Note: all_session_vars = spark.conf.getAll()&lt;/P&gt;&lt;P&gt;returns&lt;/P&gt;&lt;PRE&gt;AttributeError: &lt;SPAN class=""&gt;'RuntimeConfig'&lt;/SPAN&gt; &lt;SPAN class=""&gt;object&lt;/SPAN&gt; has no attribute &lt;SPAN class=""&gt;'getAll'&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;so it looks like a runtime-level config&lt;/P&gt;</description>
      <pubDate>Sun, 27 Aug 2023 10:22:37 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-list-all-spark-session-config-variables/m-p/41952#M27383</guid>
      <dc:creator>gpierard</dc:creator>
      <dc:date>2023-08-27T10:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to list all spark session config variables</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-list-all-spark-session-config-variables/m-p/42743#M27414</link>
      <description>&lt;P&gt;&amp;nbsp;wrote:&lt;/P&gt;&lt;PRE&gt;spark.conf.&lt;SPAN class=""&gt;set&lt;/SPAN&gt;(&lt;SPAN class=""&gt;f"dataset.bookstore"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;'123'&lt;/SPAN&gt;) &lt;SPAN class=""&gt;#dataset_bookstore&lt;/SPAN&gt;
spark.conf.get(&lt;SPAN class=""&gt;f"dataset.bookstore"&lt;/SPAN&gt;)&lt;SPAN class=""&gt;#123&lt;/SPAN&gt;
scf = spark.sparkContext.getConf()
allc = scf.getAll()
scf.contains(&lt;SPAN class=""&gt;f"dataset.bookstore"&lt;/SPAN&gt;) &lt;SPAN class=""&gt;# False&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;spark.conf?&amp;nbsp;&amp;nbsp;&lt;A href="https://www.mayoclinicpatientportals.com/" target="_self"&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#FFFFFF"&gt;Mayo Clinic Patient Portal&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Note: all_session_vars = spark.conf.getAll()&lt;/P&gt;&lt;P&gt;returns&lt;/P&gt;&lt;PRE&gt;AttributeError: &lt;SPAN class=""&gt;'RuntimeConfig'&lt;/SPAN&gt; &lt;SPAN class=""&gt;object&lt;/SPAN&gt; has no attribute &lt;SPAN class=""&gt;'getAll'&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;so it looks like a runtime-level config&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;In Databricks, you can set session-level configuration variables using spark.conf.set(), but these session-level variables are distinct from the context-level variables. While you can retrieve session-level variables using spark.conf.get(), you cannot directly retrieve all session-level variables using spark.conf.getAll().&lt;/P&gt;&lt;P&gt;session_conf = spark.sparkContext.getConf()&lt;BR /&gt;all_session_vars = [(key, session_conf.get(key)) for key in session_conf.getAll()]&lt;/P&gt;&lt;P&gt;# Now all_session_vars contains a list of tuples with session-level variables&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2023 08:09:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-list-all-spark-session-config-variables/m-p/42743#M27414</guid>
      <dc:creator>Davidbruner</dc:creator>
      <dc:date>2023-08-29T08:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to list all spark session config variables</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-list-all-spark-session-config-variables/m-p/42783#M27420</link>
      <description>&lt;P&gt;Turns out there is a way, see&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/76986516/how-to-retrieve-all-spark-session-config-variables" target="_blank" rel="noopener"&gt;https://stackoverflow.com/questions/76986516/how-to-retrieve-all-spark-session-config-variables&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2023 11:31:24 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-list-all-spark-session-config-variables/m-p/42783#M27420</guid>
      <dc:creator>gpierard</dc:creator>
      <dc:date>2023-08-29T11:31:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to list all spark session config variables</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-list-all-spark-session-config-variables/m-p/82427#M36647</link>
      <description>&lt;P&gt;A while back I think I found a way to get python to list all the config values.&amp;nbsp; I was not able to re-create it.&amp;nbsp; Just make one of your notebook code sections scala (first line) and use the second line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;%&lt;/SPAN&gt;&lt;SPAN&gt;scala&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;(spark.conf.getAll).foreach(println)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 08 Aug 2024 16:54:45 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-list-all-spark-session-config-variables/m-p/82427#M36647</guid>
      <dc:creator>RyanHager</dc:creator>
      <dc:date>2024-08-08T16:54:45Z</dc:date>
    </item>
  </channel>
</rss>

