duckrun 0.2.9.dev4__tar.gz → 0.2.9.dev5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: duckrun
3
- Version: 0.2.9.dev4
3
+ Version: 0.2.9.dev5
4
4
  Summary: Lakehouse task runner powered by DuckDB for Microsoft Fabric
5
5
  Author: mim
6
6
  License: MIT
@@ -2,7 +2,7 @@
2
2
 
3
3
  from duckrun.core import Duckrun
4
4
 
5
- __version__ = "0.2.9.dev4"
5
+ __version__ = "0.2.9.dev5"
6
6
 
7
7
  # Expose unified connect method at module level
8
8
  connect = Duckrun.connect
@@ -130,7 +130,7 @@ def check_dataset_exists(dataset_name, workspace_id, client):
130
130
 
131
131
 
132
132
  def refresh_dataset(dataset_name, workspace_id, client, dataset_id=None):
133
- """Refresh a dataset and monitor progress"""
133
+ """Refresh a dataset and monitor progress using Power BI API"""
134
134
 
135
135
  # If dataset_id not provided, look it up by name
136
136
  if not dataset_id:
@@ -144,39 +144,46 @@ def refresh_dataset(dataset_name, workspace_id, client, dataset_id=None):
144
144
  "objects": []
145
145
  }
146
146
 
147
- response = client.post(
148
- f"/v1/workspaces/{workspace_id}/semanticModels/{dataset_id}/refreshes",
149
- json=payload
150
- )
147
+ # Use Power BI API for refresh (not Fabric API)
148
+ powerbi_url = f"https://api.powerbi.com/v1.0/myorg/datasets/{dataset_id}/refreshes"
149
+ headers = client._get_headers()
150
+
151
+ response = requests.post(powerbi_url, headers=headers, json=payload)
151
152
 
152
153
  if response.status_code in [200, 202]:
153
154
  print(f"✓ Refresh initiated")
154
155
 
155
- refresh_id = response.json().get('id')
156
- if refresh_id:
157
- print(" Monitoring refresh progress...")
158
- max_attempts = 60
159
- for attempt in range(max_attempts):
160
- time.sleep(5)
161
-
162
- status_response = client.get(
163
- f"/v1/workspaces/{workspace_id}/semanticModels/{dataset_id}/refreshes/{refresh_id}"
164
- )
165
- status = status_response.json().get('status')
156
+ # For 202, get the refresh_id from the Location header
157
+ if response.status_code == 202:
158
+ location = response.headers.get('Location')
159
+ if location:
160
+ refresh_id = location.split('/')[-1]
161
+ print(" Monitoring refresh progress...")
162
+ max_attempts = 60
163
+ for attempt in range(max_attempts):
164
+ time.sleep(5)
165
+
166
+ # Check refresh status using Power BI API
167
+ status_url = f"https://api.powerbi.com/v1.0/myorg/datasets/{dataset_id}/refreshes/{refresh_id}"
168
+ status_response = requests.get(status_url, headers=headers)
169
+ status_response.raise_for_status()
170
+ status = status_response.json().get('status')
171
+
172
+ if status == 'Completed':
173
+ print(f"✓ Refresh completed successfully")
174
+ return
175
+ elif status == 'Failed':
176
+ error = status_response.json().get('serviceExceptionJson', '')
177
+ raise Exception(f"Refresh failed: {error}")
178
+ elif status == 'Cancelled':
179
+ raise Exception("Refresh was cancelled")
180
+
181
+ if attempt % 6 == 0:
182
+ print(f" Status: {status}...")
166
183
 
167
- if status == 'Completed':
168
- print(f"✓ Refresh completed successfully")
169
- return
170
- elif status == 'Failed':
171
- error = status_response.json().get('error', {})
172
- raise Exception(f"Refresh failed: {error.get('message', 'Unknown error')}")
173
- elif status == 'Cancelled':
174
- raise Exception("Refresh was cancelled")
175
-
176
- if attempt % 6 == 0:
177
- print(f" Status: {status}...")
178
-
179
- raise Exception(f"Refresh timed out")
184
+ raise Exception(f"Refresh timed out")
185
+ else:
186
+ response.raise_for_status()
180
187
 
181
188
 
182
189
  def download_bim_from_github(url):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: duckrun
3
- Version: 0.2.9.dev4
3
+ Version: 0.2.9.dev5
4
4
  Summary: Lakehouse task runner powered by DuckDB for Microsoft Fabric
5
5
  Author: mim
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "duckrun"
7
- version = "0.2.9.dev4"
7
+ version = "0.2.9.dev5"
8
8
  description = "Lakehouse task runner powered by DuckDB for Microsoft Fabric"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
File without changes
File without changes
File without changes