With the new Schema’s in a Lakehouse, it now is possible to read from Lakehouse A (In Workspace A) and write to Lakehouse B (In Workspace B).

Here are more details about the Schema preview: Lakehouse schemas (Preview) – Microsoft Fabric | Microsoft Learn

This opens a whole new world of possibilities.

I also really like the fact that I can simply use the Names, and I do not need to get the actual GUIDS!

For example, I can use the following as shown below which is WorkspaceName.LakehouseName,SchemaName.TableName

This is what it looks like in my notebook example below.

For example, I could create parameters in my notebook for the source and destination Lakehouse’s.

I could then create a Pipeline which I can re-use multiple times, because I can then pass through via the parameters where I want to read and write my data into.

This could be then used for the Metadata Drive approach where I am loading data between my Bronze and Silver layers.

Here is an example below.

The first thing I had to do was to attach my notebook to my Lakehouse where the Schema preview is enabled. If I did not do this then I would get an error, so please be aware of this.

In the first code cell I have created it as a Parameter Cell.

NOTE: You can see that I have created a new schema called “staging” and my table has got spaces in the name “tb salesOutput”

A screenshot of a computer

Description automatically generated

The second code cell is where I am combining the values into a single variable for my source and destination.

NOTE: You can see the outputs as highlighted below.

You might also notice that I still used the backtick, this was to ensure that it would write successfully. I did try it without the backticks, but it did not work.

A screenshot of a computer screen

Description automatically generated

The final code cell is where I am now writing the data to another table in a different lakehouse.

A screenshot of a computer

Description automatically generated

I could then see the updated data on my destination table.

Summary

In this blog post I have shown you how to read and write data where both the tables, schemas and workspaces are different.

Thanks for reading!

You can download a copy of the notebook here: Fabric/Blog – Reading and Write different Lakehouses.ipynb at main · GilbertQue/Fabric