Skip to main content

Customize code on Fabric Lakehouse


Thomas Hjermitslev
Community Manager

When you use Microsoft Fabric Lakehouse as Prepare instance storage, you can use the customize code feature to add a custom script that is executed along with the table. To be specific, the script will be added as a custom cell in table deployment notebook. This cell is executed as the last step before persisting all tables.

A custom script can be added to multiple tables and can reference other existing tables, fields and custom scripts. An initial deployment is necessary before adding custom code. The script is entered as a ‘Custom Fabric Script’ and then mapped to the table using the customize code feature.


Add a Custom Fabric Script

To add a Custom Fabric Script, follow the steps below.

  1. Right-click the Scripts menu in the data area and click Add Custom Fabric Script
     
  2. In the script window, write a PySpark script compatible with the supported environment (Spark 3.4, Delta 2.4). Tables, fields and other custom scripts can be dragged into the editor and added as parameters. 

     

Add a script to deployment notebook

To add the script to the table where code should be customized, follow the steps below.

  1. Right-click the table you want to add the script to, click Advanced and then click Customize Code.

     

  2. Click Add Fabric Script and, in the window that appears, select the script you want to use from Script list.
     
  3. Check that the script has been added to the notebook right before the “Persist Data” block, then click OK.

     

Did this topic help you find an answer to your question?

0 replies

Be the first to reply!

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings