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
This issue was reported to the semantic-link-labs package maintainers mid-June: SQL endpoint refresh fails on empty lakehouse · Issue #719 · microsoft/semantic-link-labs
and the fix was published in release 0.11.0 of the SLL package: Release semantic-link-labs 0.11.0 · microsoft/semantic-link-labs · GitHub
I haven't verified yet but upgrading to use at least this version should resolve the problem, i.e.
!pip install semantic-link-labs>=0.11.0
- alfBI10 months agoResponsive Resident
Hi,
We have tried to apply the fix you suggested using the version later than 11.0 but problems remains. Again the call to
x = labs.refresh_sql_endpoint_metadata(item=artifact_name, type=artifact_type, workspace=workspace, tables=tables)seems to work intermittently. If I ran the notebook manually seems fine but on the schedule execution following errror is raised:---> 17 x = labs.refresh_sql_endpoint_metadata(item=artifact_name, type=artifact_type, workspace=workspace, tables=tables) 18 display(x) File ~/jupyter-env/python3.11/lib/python3.11/site-packages/sempy/_utils/_log.py:371, in mds_log.<locals>.get_wrapper.<locals>.log_decorator_wrapper(*args, **kwargs) 368 start_time = time.perf_counter() 370 try: --> 371 result = func(*args, **kwargs) 373 # The invocation for get_message_dict moves after the function 374 # so it can access the state after the method call 375 message.update(extractor.get_completion_message_dict(result, arg_dict)) File ~/jupyter-env/python3.11/lib/python3.11/site-packages/sempy_labs/_sql_endpoints.py:144, in refresh_sql_endpoint_metadata(item, type, workspace, tables) 136 if tables: 137 payload = { 138 "tableDefinitions": [ 139 {"schema": schema, "tableNames": tables} 140 for schema, tables in tables.items() 141 ] 142 } --> 144 result = _base_api( 145 request=f"v1/workspaces/{workspace_id}/sqlEndpoints/{sql_endpoint_id}/refreshMetadata", 146 method="post", 147 client="fabric_sp", 148 status_codes=[200, 202], 149 lro_return_json=True, 150 payload=payload, 151 ) 153 columns = { 154 "Table Name": "string", 155 "Status": "string", (...) 160 "Error Message": "string", 161 } 163 if result: File ~/jupyter-env/python3.11/lib/python3.11/site-packages/sempy_labs/_helper_functions.py:2249, in _base_api(request, client, method, payload, status_codes, uses_pagination, lro_return_json, lro_return_status_code) 2241 response = requests.request( 2242 method.upper(), 2243 url, 2244 headers=headers, 2245 json=payload, 2246 ) 2248 if lro_return_json: -> 2249 return lro(c, response, status_codes).json() 2250 elif lro_return_status_code: 2251 return lro(c, response, status_codes, return_status_code=True) File ~/jupyter-env/python3.11/lib/python3.11/site-packages/sempy_labs/_helper_functions.py:1592, in lro(client, response, status_codes, sleep_time, return_status_code) 1590 result = response.status_code 1591 else: -> 1592 response = client.get(f"/v1/operations/{operationId}/result") 1593 result = response 1595 return result File ~/jupyter-env/python3.11/lib/python3.11/site-packages/sempy/fabric/_client/_rest_client.py:188, in BaseRestClient.get(self, path_or_url, *args, **kwargs) 169 def get(self, path_or_url: str, *args, **kwargs): 170 """ 171 GET request to the Fabric and PowerBI REST API. 172 (...) 186 The response from the REST API. 187 """ --> 188 return self.request("GET", path_or_url, *args, **kwargs) File ~/jupyter-env/python3.11/lib/python3.11/site-packages/sempy/fabric/_client/_rest_client.py:429, in FabricRestClient.request(self, method, path_or_url, lro_wait, lro_max_attempts, lro_operation_name, *args, **kwargs) 396 def request(self, 397 method: str, 398 path_or_url: str, (...) 402 *args, 403 **kwargs): 404 """ 405 Request to the Fabric REST API. 406 (...) 427 The response from the REST API. 428 """ --> 429 response = super().request(method, path_or_url, *args, **kwargs) 431 if not lro_wait or response.status_code != 202: 432 return response File ~/jupyter-env/python3.11/lib/python3.11/site-packages/sempy/fabric/_client/_rest_client.py:167, in BaseRestClient.request(self, method, path_or_url, *args, **kwargs) 164 kwargs["url"] = url 165 kwargs["headers"] = headers --> 167 return self.http.request(method, *args, **kwargs) File ~/jupyter-env/python3.11/lib/python3.11/site-packages/requests/sessions.py:589, in Session.request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json) 584 send_kwargs = { 585 "timeout": timeout, 586 "allow_redirects": allow_redirects, 587 } 588 send_kwargs.update(settings) --> 589 resp = self.send(prep, **send_kwargs) 591 return resp File ~/jupyter-env/python3.11/lib/python3.11/site-packages/requests/sessions.py:710, in Session.send(self, request, **kwargs) 707 r.elapsed = timedelta(seconds=elapsed) 709 # Response manipulation hooks --> 710 r = dispatch_hook("response", hooks, r, **kwargs) 712 # Persist cookies 713 if r.history: 714 # If the hooks create history then we want those cookies too File ~/jupyter-env/python3.11/lib/python3.11/site-packages/requests/hooks.py:30, in dispatch_hook(key, hooks, hook_data, **kwargs) 28 hooks = [hooks] 29 for hook in hooks: ---> 30 _hook_data = hook(hook_data, **kwargs) 31 if _hook_data is not None: 32 hook_data = _hook_data File ~/jupyter-env/python3.11/lib/python3.11/site-packages/sempy/_utils/_log.py:371, in mds_log.<locals>.get_wrapper.<locals>.log_decorator_wrapper(*args, **kwargs) 368 start_time = time.perf_counter() 370 try: --> 371 result = func(*args, **kwargs) 373 # The invocation for get_message_dict moves after the function 374 # so it can access the state after the method call 375 message.update(extractor.get_completion_message_dict(result, arg_dict)) File ~/jupyter-env/python3.11/lib/python3.11/site-packages/sempy/fabric/_client/_rest_client.py:105, in BaseRestClient.__init__.<locals>.validate_rest_response(response, *args, **kwargs) 102 @log_rest_response 103 def validate_rest_response(response, *args, **kwargs): 104 if response.status_code >= 400: --> 105 raise FabricHTTPException(response) FabricHTTPException: 400 Bad Request for url: https://api.fabric.microsoft.com//v1/operations/09343336-2bab-430b-8deb-5bda3c915a0e/result Error: {"requestId":"ffc1dc36-d14c-4245-9f5e-9dc8ebb2687a","errorCode":"OperationHasNoResult","message":"The operation has no result"} Headers: {'Cache-Control': 'no-store, must-revalidate, no-cache', 'Pragma': 'no-cache', 'Transfer-Encoding': 'chunked', 'Content-Type': 'application/json; charset=utf-8', 'x-ms-public-api-error-code': 'OperationHasNoResult', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'X-Frame-Options': 'deny', 'X-Content-Type-Options': 'nosniff', 'RequestId': 'ffc1dc36-d14c-4245-9f5e-9dc8ebb2687a', 'Access-Control-Expose-Headers': 'RequestId', 'request-redirected': 'true', 'home-cluster-uri': 'https://wabi-west-europe-b-primary-redirect.analysis.windows.net/', 'Date': 'Mon, 15 Sep 2025 03:21:49 GMT'}
Any idea abotu what is wrong? Seems extremely difficult to use this
- v-dineshya10 months agoCommunity Support
Hi alfBI ,
It appears this issue might require deeper investigation from the Power BI support team. I recommend opening a Microsoft support ticket so they can trace the issue.
To raise a support ticket for Fabric and Power BI, kindly follow the steps outlined in the following guide:
How to create a Fabric and Power BI Support ticket - Power BI | Microsoft Learn
Regards,
Dinesh
- alfBI10 months agoResponsive Resident
Well, we have done something similar by creating a bug here
Issues · microsoft/semantic-link-labs
Hope it helps,
Alfons
- SJCuthbertson10 months agoAdvocate I
This error that you've pasted here, and raised via sempy-labs GitHub as issue #870, is completely unrelated to the error that you originally started this community forum discussion with.
The original one was a KeyError, to do with what tables you were refreshing or what tables exist in the lakehouse.
This one is a FabricHTTPException from a totally different part of the code. They're not related.
I'm not sure of the underlying cause of these intermittent FabricHTTPException errors (github #870) and I'm not at all sure if it's a problem in sempy-labs. I think more likely it's a problem in the API itself, but let's wait for v0.12.4 of sempy-labs to get the complete fix that Michael has started there.
I have a Fabric support case open with Microsoft about this too and I would recommend you do the same, because more support cases will mean more attention.
- alfBI10 months agoResponsive Resident
Yes, the original topic of the problem was related with the change of the parameters supported by the API and as a result by sempy labs (the table parameter was not longer supported). This problem was fixed in latest release 12.3. As well you said this fix not has definitely solved the problem of refreshing the sql endpoint as an HTTP exception is triggered (we noticed also this problem before 12.3). Let's see if the problem relies on sempy or the API (in this later case I agree with you about to create a Fabric ticket). Thx for the clarification for future post readers.