Forum Discussion
write table in lakehouse
- Anonymous3 years ago
Hi jcamilo1985 - Thanks for using Fabric Community,
As I understand you are very new to fabric and sparkR, would like to learn explore things on it.
I am sharing few links that helps you get more insights with fabric and sparkR.
Fabric Link: It helps you understand these new resources (datamart, lakehouse, pipeline...)
Get started with Microsoft Fabric - Training | Microsoft Learn
Spark R Link: helps to understand how to use SparkR
SparkR overview - Azure Databricks | Microsoft Learn
Tutorial: Work with SparkR SparkDataFrames on Databricks | Databricks on AWS
I was able to create a table in lakehouse using below code, attached screenshot for reference -# tableName <- "<catalog-name>.<schema-name>.<table-name>" tableName <- "gopi_lake_house.abc" data <- list( list(1L, "Raymond", "green", "apple"), list(2L, "Loretta", "purple", "grape"), list(3L, "Wayne", "yellow", "banana") ) schema <- structType( structField("id", "integer"), structField("name", "string"), structField("color", "string"), structField("fruit", "string") ) df <- createDataFrame( data = data, schema = schema ) saveAsTable( df = df, tableName = tableName ) # Verify that the table was successfully saved by # displaying the table's contents. display(sql(paste0("SELECT * FROM ", tableName)))
Hope this helps your query. Happy Learning.!
Hi jcamilo1985 - Thanks for using Fabric Community,
As I understand you are very new to fabric and sparkR, would like to learn explore things on it.
I am sharing few links that helps you get more insights with fabric and sparkR.
Fabric Link: It helps you understand these new resources (datamart, lakehouse, pipeline...)
Get started with Microsoft Fabric - Training | Microsoft Learn
Spark R Link: helps to understand how to use SparkR
SparkR overview - Azure Databricks | Microsoft Learn
Tutorial: Work with SparkR SparkDataFrames on Databricks | Databricks on AWS
I was able to create a table in lakehouse using below code, attached screenshot for reference -
# tableName <- "<catalog-name>.<schema-name>.<table-name>"
tableName <- "gopi_lake_house.abc"
data <- list(
list(1L, "Raymond", "green", "apple"),
list(2L, "Loretta", "purple", "grape"),
list(3L, "Wayne", "yellow", "banana")
)
schema <- structType(
structField("id", "integer"),
structField("name", "string"),
structField("color", "string"),
structField("fruit", "string")
)
df <- createDataFrame(
data = data,
schema = schema
)
saveAsTable(
df = df,
tableName = tableName
)
# Verify that the table was successfully saved by
# displaying the table's contents.
display(sql(paste0("SELECT * FROM ", tableName)))
Hope this helps your query. Happy Learning.!
Anonymous
Thank you very much for responding to the request, this solution indeed works.
Thanks for the links, now let's learn.