<?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 access data objects from different languages [R/SQL/Spark/Python] in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15359#M9691</link>
    <description>&lt;P&gt;Thanks. I took that approach to create view and then queried it using SQL from R:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%r&lt;/P&gt;&lt;P&gt;rd=as.data.frame(sql("select * from CNTRY_FLOWS"))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...not sure if there's a more direct route. I was unsure what the equivalent to python spark.read.table() for R was.&lt;/P&gt;</description>
    <pubDate>Tue, 05 Jul 2022 14:50:45 GMT</pubDate>
    <dc:creator>fs</dc:creator>
    <dc:date>2022-07-05T14:50:45Z</dc:date>
    <item>
      <title>how to access data objects from different languages [R/SQL/Spark/Python]</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15357#M9689</link>
      <description>&lt;P&gt;Hi sorry new to Spark, DataBricks. Please could someone summarise options for moving data between these different languages. Esp. interested in R&amp;lt;=&amp;gt;Python options: can see how to do SQL/Spark. Spent a lot of time googling but no result. Presume can use R's reticulate to access python objects..?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway grateful for any idiot-proof links, quick guides, code.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2022 12:25:39 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15357#M9689</guid>
      <dc:creator>fs</dc:creator>
      <dc:date>2022-06-30T12:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to access data objects from different languages [R/SQL/Spark/Python]</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15358#M9690</link>
      <description>&lt;P&gt;Hi, you can create a temporary table and then retrieve it with every rogramming language:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ex create in sql: &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;%sql
CREATE OR REPLACE TEMPORARY VIEW Test1 AS
 SELECT *
 FROM TEST&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And then retrieve in python&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;%python
spark.read.table('Test1')&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2022 14:38:50 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15358#M9690</guid>
      <dc:creator>Pholo</dc:creator>
      <dc:date>2022-06-30T14:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to access data objects from different languages [R/SQL/Spark/Python]</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15359#M9691</link>
      <description>&lt;P&gt;Thanks. I took that approach to create view and then queried it using SQL from R:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%r&lt;/P&gt;&lt;P&gt;rd=as.data.frame(sql("select * from CNTRY_FLOWS"))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...not sure if there's a more direct route. I was unsure what the equivalent to python spark.read.table() for R was.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 14:50:45 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15359#M9691</guid>
      <dc:creator>fs</dc:creator>
      <dc:date>2022-07-05T14:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to access data objects from different languages [R/SQL/Spark/Python]</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15360#M9692</link>
      <description>&lt;P&gt;If you’re using R I highly recommend the sparklyr package from RStudio.  Many of the pyspark functions have the same name, for example, “spark.read.table()” is “spark_read_table” in sparklyr.  More info here:  &lt;A href="https://spark.rstudio.com/packages/sparklyr/latest/reference/spark_read_table.html" target="test_blank"&gt;https://spark.rstudio.com/packages/sparklyr/latest/reference/spark_read_table.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 05:47:50 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15360#M9692</guid>
      <dc:creator>mgiglia</dc:creator>
      <dc:date>2022-07-06T05:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to access data objects from different languages [R/SQL/Spark/Python]</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15361#M9693</link>
      <description>&lt;P&gt;One other thing I thought of— with Spark you want to keep your data in Spark as much as possible and not bring it back to R unless you have too.  With Sparklyr you can use many tidyverse functions directly in Spark without having to collect your results and put them in a data frame first.   For R functions or packages that don’t have a connection to the Spark API directly you can also use sparklyr::spark_apply to distribute your R code over the cluster and leave your Spark data frames in spark.  &lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 05:58:28 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15361#M9693</guid>
      <dc:creator>mgiglia</dc:creator>
      <dc:date>2022-07-06T05:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to access data objects from different languages [R/SQL/Spark/Python]</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15362#M9694</link>
      <description>&lt;P&gt;@Simone Folino​&amp;nbsp;&amp;amp; @Matthew Giglia​&amp;nbsp;Amazing responses, thank you for jumping in and providing your personal expertise in this thread! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Fernley Symons​&amp;nbsp;I think we are all eager to hear if these suggestions got you 100% sorted! If so, feel free to choose one of the replies as "best" so the rest of the community knows this question is answered in the future. If not, feel free to let us know what else you need. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 23:01:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15362#M9694</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-07-06T23:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: how to access data objects from different languages [R/SQL/Spark/Python]</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15363#M9695</link>
      <description>&lt;P&gt;Thanks so much for this. Actually most of my code has been python to date. It was really about knowing how to access objects from one language in the others—e.g. I had some R code to produce a graph that I wanted to recycle.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 10:30:40 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15363#M9695</guid>
      <dc:creator>fs</dc:creator>
      <dc:date>2022-07-07T10:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to access data objects from different languages [R/SQL/Spark/Python]</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15364#M9696</link>
      <description>&lt;P&gt;I think there's a trick which still hasn't (yet) been achieved in spark. Why can't there be standard syntax to access all objects across all languages it supports (with appropriate data structure translation).&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 10:32:08 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15364#M9696</guid>
      <dc:creator>fs</dc:creator>
      <dc:date>2022-07-07T10:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to access data objects from different languages [R/SQL/Spark/Python]</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15365#M9697</link>
      <description>&lt;P&gt;Depending on what you’re doing there is a package called reticulate in R that lets you directly share objects between R and python, Spark not required.  &lt;A href="https://rstudio.github.io/reticulate/" alt="https://rstudio.github.io/reticulate/" target="_blank"&gt;https://rstudio.github.io/reticulate/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However I’ve found (so far) it really only works in RStudio, which does run awesomely on Databricks when using the DB ML distributions.  You can find RStudio preinstalled on the DB cluster under “apps” on the cluster’s page when you deselect the cluster auto termination for inactivity: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Cluster settings needed to run RStudio on Databricks"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/1748i853F615FAD9C3828/image-size/large?v=v2&amp;amp;px=999" role="button" title="Cluster settings needed to run RStudio on Databricks" alt="Cluster settings needed to run RStudio on Databricks" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Rstudio under “Apps”"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/1749i1210477394424A99/image-size/large?v=v2&amp;amp;px=999" role="button" title="Rstudio under “Apps”" alt="Rstudio under “Apps”" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is a bit more set up once in RStudio on DB to make reticulate work flawlessly that I could post if interested.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I haven’t tested yet is what happens if you make an Rmd using reticulate in RStudio on Databricks and then try to schedule that in a DB Workflow later.  If I do I’ll be sure to post about it in the community.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I’d love it if more direct adoption of reticulate was included in Databricks notebooks that extended it to Scala and SQL too, like you’ve suggested.  Each language has its advantages in my opinion, and there are some really awesome ML packages in tidymodels for R that get frequently overlooked by the python community in my opinion because the switching between languages is difficult in most places.  &lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 04:45:58 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15365#M9697</guid>
      <dc:creator>mgiglia</dc:creator>
      <dc:date>2022-07-08T04:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to access data objects from different languages [R/SQL/Spark/Python]</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15366#M9698</link>
      <description>&lt;P&gt;hi thanks for this. Yes I was aware of reticulate, if not its use in databricks. Actually most of my code is python. It's just had an issue getting some libraries to load and had R code for that so wanted to include an R chunk. &lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 11:46:57 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15366#M9698</guid>
      <dc:creator>fs</dc:creator>
      <dc:date>2022-07-08T11:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: how to access data objects from different languages [R/SQL/Spark/Python]</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15367#M9699</link>
      <description>&lt;P&gt;Hi @Fernley Symons​&amp;nbsp;Gentle reminder on the answer provided above. Please let us know if you have more doubts or queries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2022 10:05:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15367#M9699</guid>
      <dc:creator>Noopur_Nigam</dc:creator>
      <dc:date>2022-07-25T10:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: how to access data objects from different languages [R/SQL/Spark/Python]</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15368#M9700</link>
      <description>&lt;P&gt;? I've already voted best answer...&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2022 10:08:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15368#M9700</guid>
      <dc:creator>fs</dc:creator>
      <dc:date>2022-07-25T10:08:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to access data objects from different languages [R/SQL/Spark/Python]</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15369#M9701</link>
      <description>&lt;P&gt;@Fernley Symons​&amp;nbsp;Thank you for your prompt reply. Apologies, we have just noticed that an answer is already marked as best. Thank you once again.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2022 10:10:38 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-access-data-objects-from-different-languages-r-sql-spark/m-p/15369#M9701</guid>
      <dc:creator>Noopur_Nigam</dc:creator>
      <dc:date>2022-07-25T10:10:38Z</dc:date>
    </item>
  </channel>
</rss>

