Forum Discussion
Refresh SQL Endpoint using semantic link labs: Intermittent failures
- 1 year ago
Final Solution was to get rid of semantic labs approach and use directl ythe api as shown here
Example code using the new fabric rest api · GitHub
Thx
Hi alfBI ,
Thank you for reaching out to the Microsoft Community Forum.
The error message " KeyError, Error value - "['Table Name', 'Status', 'Start Time', 'End Time', 'Last Successful Sync Time'] not in index"'", This typically indicates that the notebook is trying to access columns in a DataFrame that don’t exist, because the Lakehouse is empty or the SQL Endpoint metadata has not been initialized properly.
Please check below things to fix the issue.
1. Before accessing columns in the notebook, check if the DataFrame contains the expected columns. Please refer below sample python script.
expected_cols = ['Table Name', 'Status', 'Start Time', 'End Time', 'Last Successful Sync Time']
if all(col in df.columns for col in expected_cols):
df = df[expected_cols]
else:
print("Expected columns not found. DataFrame is likely empty.")
2. Check that the Lakehouse has at least one table or object before triggering the SQL Endpoint refresh. An empty Lakehouse will cause the API to return an empty response.
3. Place the notebook execution in a try-except block and log errors to help with debugging. Please refer sample python code in try-except block.
try:
# notebook execution logic
except KeyError as e:
print(f"KeyError encountered: {e}")
# optionally skip or retry
I hope this information helps. Please do let us know if you have any further queries.
Regards,
Dinesh
Final Solution was to get rid of semantic labs approach and use directl ythe api as shown here
Example code using the new fabric rest api · GitHub
Thx