Forum Discussion
Fabric Lakehouse SQL Endpoint Automatic Refresh
- Anonymous1 year ago
Hi Bill_J99294 ,
You can create a notebook that connects to the lakehouse corresponding to your SQL endpoint by entering the following command in the cell:
from pyspark.sql import SparkSession # create Spark session spark = SparkSession.builder \ .appName(“Refresh SQL Endpoint Metadata”) \ .getOrCreate() # refresh spark.sql(“REFRESH TABLE salesorders”) print(“Metadata refresh triggered successfully.”)Set up a daily refresh in your notebook settings so that this refresh command is executed every day.
If you have any other questions please feel free to contact me.
Best Regards,
Yang
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
Hi Bill_J99294 ,
You can create a notebook that connects to the lakehouse corresponding to your SQL endpoint by entering the following command in the cell:
from pyspark.sql import SparkSession
# create Spark session
spark = SparkSession.builder \
.appName(“Refresh SQL Endpoint Metadata”) \
.getOrCreate()
# refresh
spark.sql(“REFRESH TABLE salesorders”)
print(“Metadata refresh triggered successfully.”)
Set up a daily refresh in your notebook settings so that this refresh command is executed every day.
If you have any other questions please feel free to contact me.
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How can we optmize it to run for particular schema and make sure it refresh all the tables by checking counts. so that if a tables has not been refreshed the it should automatically refresh it before calling the notebook as success.