Forum Discussion
How to create a Lakehouse table without manually mounting Lakehouse in notebook
- Anonymous1 year ago
Hi PriyaJha ,
To achieve the goal without mounting Lakehouse, use the Save method instead of saveAsTable:
df = spark.read.csv(“abfss://[email protected]/daisyTest2.Lakehouse/Files/ProductsTest.csv”, header=True, inferSchema=True) df.count() table_path = “abfss://[email protected]/daisyTest2.Lakehouse/Tables/ProductsTest” df.write.format(“delta”).mode(“overwrite”).save(table_path)Replace the workspaceName, lakehouseName, and csv file in it with your own to use.
You can see that it works fine.
You can see the table being loaded after hitting refresh at the Tables in lakehouse.
If you have any other questions please feel free to contact me.
Best Regards,
Yang
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
Hi PriyaJha ,
To achieve the goal without mounting Lakehouse, use the Save method instead of saveAsTable:
df = spark.read.csv(“abfss://[email protected]/daisyTest2.Lakehouse/Files/ProductsTest.csv”, header=True, inferSchema=True)
df.count()
table_path = “abfss://[email protected]/daisyTest2.Lakehouse/Tables/ProductsTest”
df.write.format(“delta”).mode(“overwrite”).save(table_path)
Replace the workspaceName, lakehouseName, and csv file in it with your own to use.
You can see that it works fine.
You can see the table being loaded after hitting refresh at the Tables in lakehouse.
If you have any other questions please feel free to contact me.
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!