Forum Discussion
Writing to a Lakehouse in different workspace from Notebook
- 2 years ago
You can use the fully qualified path to write to a Lakehouse in another workspace.
Please see this article, it helped me:
https://murggu.medium.com/databricks-and-fabric-writing-to-onelake-and-adls-gen2-671dcf24cf33
So, to write to a table (new or existing) in a Lakehouse in another workspace, I think it is possible to write it like this:
df.write.format("delta").mode("append").save(f"abfss://{workspace_name}@onelake.dfs.fabric.microsoft.com/{lakehouse_name}.Lakehouse/Tables/{table_name}")or if your objects names have special characters or whitespace, could use the id's:df.write.format("delta").mode("append").save(f"abfss://{workspace_id}@onelake.dfs.fabric.microsoft.com/{lakehouse_id}/Tables/{table_name}")For reading you could also use the fully qualified path, as you have already done. Then I think the whole process should be independent of the default lakehouse.
You can use the fully qualified path to write to a Lakehouse in another workspace.
Please see this article, it helped me:
https://murggu.medium.com/databricks-and-fabric-writing-to-onelake-and-adls-gen2-671dcf24cf33
So, to write to a table (new or existing) in a Lakehouse in another workspace, I think it is possible to write it like this:
- AdamFry2 years ago
Advocate I
Thank you so much!
- Anonymous2 years agoNot applicable
Hi AdamFry ,
Glad to that your issue got resolved. Please continue using Fabric Community on your further queries.
- 4019Charan1 year agoFrequent Visitor
Hey so when I tried to write to a different lakehouse that's not the default lakehouse that my notebook is connected to, my data is note getting stored properly under Tables.
So my notebook is connected to bronze lakehouse and I'm trying to write data to silver lakehouse and this is how the data is getting written.
#codespark_df.write.mode('overwrite').format('delta').save('abfss://2a3820e5-f967-472d-b13f-129d5fd773ae@onelake.dfs.fabric.microsoft.com/cbfe0b20-fd8d-4252-818f-8e0de0b31272/Tables/test-1')
Result
The data supposed to go into test-1 table but instead it is going into Undefined space and also the data is not getting written in table format.
Please do assist me on this frithjof_v- frithjof_v1 year ago
Community Champion
It's looks like it's a schema enabled lakehouse. In that case, you need to specify the schema in the abfss path.
- 4019Charan1 year agoFrequent Visitor
I did tried adding schema but still I am getting the same response
This is the code I've executedbronze_df.write.mode('overwrite').format('parquet')\.save(f'abfss://2a3820e5-f967-472d-b13f-129d5fd773ae@onelake.dfs.fabric.microsoft.com/cbfe0b20-fd8d-4252-818f-8e0de0b31272/Tables/dbo/test-2')
This is the result of it.