<?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: Can we access the variables created in Python in Scala's code or notebook ? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/can-we-access-the-variables-created-in-python-in-scala-s-code-or/m-p/15654#M9961</link>
    <description>&lt;P&gt;Martin is correct. We could only access the external files and objects. In most of our cases, we just use temporary views to pass data between R &amp;amp; Python.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/notebooks/notebooks-use.html#mix-languages" target="test_blank"&gt;https://docs.databricks.com/notebooks/notebooks-use.html#mix-languages&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 11 Sep 2021 14:38:36 GMT</pubDate>
    <dc:creator>cpm1</dc:creator>
    <dc:date>2021-09-11T14:38:36Z</dc:date>
    <item>
      <title>Can we access the variables created in Python in Scala's code or notebook ?</title>
      <link>https://community.databricks.com/t5/data-engineering/can-we-access-the-variables-created-in-python-in-scala-s-code-or/m-p/15652#M9959</link>
      <description>&lt;P&gt;If I have a dict created in python on a Scala notebook (using magic word ofcourse):&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;%python
d1 = {1: "a", 2:"b", 3:"c"}&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Can I access this d1 in Scala ?&lt;/P&gt;&lt;P&gt;I tried the following and it returns d1 not found:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;%scala
println(d1)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Sep 2021 09:31:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/can-we-access-the-variables-created-in-python-in-scala-s-code-or/m-p/15652#M9959</guid>
      <dc:creator>Zircoz</dc:creator>
      <dc:date>2021-09-11T09:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: Can we access the variables created in Python in Scala's code or notebook ?</title>
      <link>https://community.databricks.com/t5/data-engineering/can-we-access-the-variables-created-in-python-in-scala-s-code-or/m-p/15653#M9960</link>
      <description>&lt;P&gt;Variables are not shared between language contexts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ugly workaround: you could do something like this to pass your python variable to the spark context:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;%python
d1 = {1: "a", 2:"b", 3:"c"}
spark.conf.set('d1', str(d1))&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;%scala
println( spark.conf.get("d1") )&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, you lose variable type. You only can pass on strings.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Sep 2021 10:44:00 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/can-we-access-the-variables-created-in-python-in-scala-s-code-or/m-p/15653#M9960</guid>
      <dc:creator>MartinB</dc:creator>
      <dc:date>2021-09-11T10:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: Can we access the variables created in Python in Scala's code or notebook ?</title>
      <link>https://community.databricks.com/t5/data-engineering/can-we-access-the-variables-created-in-python-in-scala-s-code-or/m-p/15654#M9961</link>
      <description>&lt;P&gt;Martin is correct. We could only access the external files and objects. In most of our cases, we just use temporary views to pass data between R &amp;amp; Python.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/notebooks/notebooks-use.html#mix-languages" target="test_blank"&gt;https://docs.databricks.com/notebooks/notebooks-use.html#mix-languages&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Sep 2021 14:38:36 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/can-we-access-the-variables-created-in-python-in-scala-s-code-or/m-p/15654#M9961</guid>
      <dc:creator>cpm1</dc:creator>
      <dc:date>2021-09-11T14:38:36Z</dc:date>
    </item>
  </channel>
</rss>

