How to sql select in RStudio to Databricks

There a multiple way to connect to different datasource. When running RStudio Server inside Databricks you can use the SparkR library and do a SparkR sql with normal sql select statements like this

# init Spark for R
library(SparkR)

sparkR.session()

# save select statement to dataframe
df <- SparkR::sql("SELECT * FROM default.my_table")


# display dataframe
showDF(df)

In the terminal you’ll be able to display the result.

How to sql select in RStudio to Databricks