Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
jgarcia-alvarez
Frequent Visitor

Refresh Lakehouse after load data with copy activity in Data Factory Pipeline

Hi all,

 

I have created a Data Factory pipeline in Fabric to move data among the different layers (Lakehouses) using Notebooks and Copy activities and once data is in Gold Lakehouse I need to replicate it in a Warehouse. For that I am using a stored procedure, but it is not able to read the recent data until I refresh the Lakehouse manually. I added a Wait (60 seconds) activity before the Stored Procedure but it not refreshing automatically.

 

Could you let me know how to create an activity / set of activities to refresh the Lakehouse? As we don't have a specific activity for that is there any best practice?

 

Thanks in advance for your help.

1 ACCEPTED SOLUTION
v-nuoc-msft
Community Support
Community Support

Hi @jgarcia-alvarez 

 

It looks like you want to make sure the data is up to date in Lakehouse before running the stored procedure.


You might consider using a custom script activity or notebook in the pipeline. This script can programmatically trigger a refresh of Lakehouse. For example:

 

# Example script to refresh Lakehouse
import requests

# Define your Lakehouse refresh endpoint and authentication details
refresh_url = "https://your-lakehouse-endpoint/refresh"
headers = {
    "Authorization": "Bearer your_access_token",
    "Content-Type": "application/json"
}

# Send the refresh request
response = requests.post(refresh_url, headers=headers)

if response.status_code == 200:
    print("Lakehouse refresh initiated successfully.")
else:
    print(f"Failed to refresh Lakehouse: {response.status_code}")

 

Ensure that the custom script activity is executed after data replication is complete.

 

vnuocmsft_0-1732672494736.png

 

I hope this helps you with your thoughts.

 

Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-nuoc-msft
Community Support
Community Support

Hi @jgarcia-alvarez 

 

It looks like you want to make sure the data is up to date in Lakehouse before running the stored procedure.


You might consider using a custom script activity or notebook in the pipeline. This script can programmatically trigger a refresh of Lakehouse. For example:

 

# Example script to refresh Lakehouse
import requests

# Define your Lakehouse refresh endpoint and authentication details
refresh_url = "https://your-lakehouse-endpoint/refresh"
headers = {
    "Authorization": "Bearer your_access_token",
    "Content-Type": "application/json"
}

# Send the refresh request
response = requests.post(refresh_url, headers=headers)

if response.status_code == 200:
    print("Lakehouse refresh initiated successfully.")
else:
    print(f"Failed to refresh Lakehouse: {response.status_code}")

 

Ensure that the custom script activity is executed after data replication is complete.

 

vnuocmsft_0-1732672494736.png

 

I hope this helps you with your thoughts.

 

Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

November Update

Fabric Monthly Update - November 2024

Check out the November 2024 Fabric update to learn about new features.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.