Skip to content

Commit

Permalink
[dagster-powerbi] Fix refreshing semantic models on non-personal work…
Browse files Browse the repository at this point in the history
…spaces (#25143)

## Summary

When testing this feature locally against a live PowerBI instance, I
ended up using a non-group scoped URL for my personal workspace. These
URLs do not work for group-scoped objects.

## How I Tested These Changes

Update unit test, test against live instance.
  • Loading branch information
benpankow authored Oct 8, 2024
1 parent 34d9560 commit ae09895
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def trigger_refresh(self, dataset_id: str) -> None:
method="POST",
endpoint=f"datasets/{dataset_id}/refreshes",
json={"notifyOption": "NoNotification"},
group_scoped=False,
group_scoped=True,
)
if response.status_code != 202:
raise Failure(f"Refresh failed to start: {response.content}")
Expand All @@ -175,7 +175,7 @@ def poll_refresh(self, dataset_id: str) -> None:

last_refresh = self._fetch_json(
f"datasets/{dataset_id}/refreshes",
group_scoped=False,
group_scoped=True,
)["value"][0]
status = last_refresh["status"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,20 @@ def test_refreshable_semantic_model(

workspace_data_api_mocks.add(
method=responses.POST,
url=f"{BASE_API_URL}/datasets/{SAMPLE_SEMANTIC_MODEL['id']}/refreshes",
url=f"{BASE_API_URL}/groups/{workspace_id}/datasets/{SAMPLE_SEMANTIC_MODEL['id']}/refreshes",
json={"notifyOption": "NoNotification"},
status=202,
)

workspace_data_api_mocks.add(
method=responses.GET,
url=f"{BASE_API_URL}/datasets/{SAMPLE_SEMANTIC_MODEL['id']}/refreshes",
url=f"{BASE_API_URL}/groups/{workspace_id}/datasets/{SAMPLE_SEMANTIC_MODEL['id']}/refreshes",
json={"value": [{"status": "Unknown"}]},
status=200,
)
workspace_data_api_mocks.add(
method=responses.GET,
url=f"{BASE_API_URL}/datasets/{SAMPLE_SEMANTIC_MODEL['id']}/refreshes",
url=f"{BASE_API_URL}/groups/{workspace_id}/datasets/{SAMPLE_SEMANTIC_MODEL['id']}/refreshes",
json={
"value": [{"status": "Completed" if success else "Failed", "serviceExceptionJson": {}}]
},
Expand Down

0 comments on commit ae09895

Please sign in to comment.