Forum Discussion
Fabric Notebook read data from Lakehouse folder and write (Overwrite/Append) to Warehouse Table
- 1 year ago
It worked well, appreciate for help.
Once you have the DataFrame from the lakehouse, you can write it to a warehouse table residing in a different workspace using the Fabric Spark connector for Data Warehouse.
If you want to append the data to an existing table (or create the table if it does not exist), you can use the `synapsesql` method with a specified write mode.
df.write.mode("append").synapsesql("<warehouse_name>.dbo.Tablename")
If your warehouse is in a different workspace from the one running your notebook, specify the target workspace ID using an appropriate option. For example, you can add:
df.write.option(Constants.WorkspaceId, "<target_workspace_id>").mode("append").synapsesql("<warehouse_name>.dbo.Tablename")
It worked well, appreciate for help.