msdev-kit 0.1.4__tar.gz → 0.1.6__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.
- {msdev_kit-0.1.4 → msdev_kit-0.1.6}/PKG-INFO +1 -1
- {msdev_kit-0.1.4 → msdev_kit-0.1.6}/msdev_kit/__init__.py +1 -1
- {msdev_kit-0.1.4 → msdev_kit-0.1.6}/msdev_kit/fabric/report.py +33 -14
- {msdev_kit-0.1.4 → msdev_kit-0.1.6}/pyproject.toml +1 -1
- {msdev_kit-0.1.4 → msdev_kit-0.1.6}/README.md +0 -0
- {msdev_kit-0.1.4 → msdev_kit-0.1.6}/msdev_kit/auth.py +0 -0
- {msdev_kit-0.1.4 → msdev_kit-0.1.6}/msdev_kit/fabric/__init__.py +0 -0
- {msdev_kit-0.1.4 → msdev_kit-0.1.6}/msdev_kit/fabric/admin.py +0 -0
- {msdev_kit-0.1.4 → msdev_kit-0.1.6}/msdev_kit/fabric/capacity.py +0 -0
- {msdev_kit-0.1.4 → msdev_kit-0.1.6}/msdev_kit/fabric/database.py +0 -0
- {msdev_kit-0.1.4 → msdev_kit-0.1.6}/msdev_kit/fabric/dataflow.py +0 -0
- {msdev_kit-0.1.4 → msdev_kit-0.1.6}/msdev_kit/fabric/dataset.py +0 -0
- {msdev_kit-0.1.4 → msdev_kit-0.1.6}/msdev_kit/fabric/kql.py +0 -0
- {msdev_kit-0.1.4 → msdev_kit-0.1.6}/msdev_kit/fabric/notebook.py +0 -0
- {msdev_kit-0.1.4 → msdev_kit-0.1.6}/msdev_kit/fabric/operations.py +0 -0
- {msdev_kit-0.1.4 → msdev_kit-0.1.6}/msdev_kit/fabric/pipeline.py +0 -0
- {msdev_kit-0.1.4 → msdev_kit-0.1.6}/msdev_kit/fabric/utilities.py +0 -0
- {msdev_kit-0.1.4 → msdev_kit-0.1.6}/msdev_kit/fabric/workspace.py +0 -0
- {msdev_kit-0.1.4 → msdev_kit-0.1.6}/msdev_kit/graph/__init__.py +0 -0
- {msdev_kit-0.1.4 → msdev_kit-0.1.6}/msdev_kit/graph/client.py +0 -0
- {msdev_kit-0.1.4 → msdev_kit-0.1.6}/msdev_kit/sharepoint/__init__.py +0 -0
- {msdev_kit-0.1.4 → msdev_kit-0.1.6}/msdev_kit/sharepoint/client.py +0 -0
|
@@ -252,11 +252,17 @@ class Report:
|
|
|
252
252
|
visual_containers = section.get('visualContainers', [])
|
|
253
253
|
|
|
254
254
|
for vc in visual_containers:
|
|
255
|
-
# The 'name' property inside 'config' is the unique Visual ID
|
|
256
|
-
visual_id = self._get_nested_value(vc, ['config', 'name'], 'No ID')
|
|
257
255
|
visual_type = 'Unknown'
|
|
258
256
|
visual_title = 'No Title'
|
|
259
257
|
vc_config = vc.get('config', {})
|
|
258
|
+
if isinstance(vc_config, str):
|
|
259
|
+
try:
|
|
260
|
+
vc_config = json.loads(vc_config)
|
|
261
|
+
except json.JSONDecodeError:
|
|
262
|
+
vc_config = {}
|
|
263
|
+
|
|
264
|
+
# The 'name' property inside 'config' is the unique Visual ID
|
|
265
|
+
visual_id = vc_config.get('name', 'No ID')
|
|
260
266
|
|
|
261
267
|
# --- 1. Handle Visual Groups (e.g., Filter Pane) ---
|
|
262
268
|
single_visual_group = vc_config.get('singleVisualGroup')
|
|
@@ -327,9 +333,11 @@ class Report:
|
|
|
327
333
|
|
|
328
334
|
# Convert the list of records into a Pandas DataFrame
|
|
329
335
|
report_name = self.get_report_name(workspace_id, report_id).replace(' ', '').replace('(', '').replace(')', '').strip()
|
|
336
|
+
folder_path = f'{self.data_dir}/pages_and_visuals'
|
|
337
|
+
os.makedirs(folder_path, exist_ok=True)
|
|
330
338
|
df = pd.DataFrame(report_records)
|
|
331
339
|
df.sort_values(by=['pageIndex', 'title'], inplace=True)
|
|
332
|
-
df.to_excel(f'{
|
|
340
|
+
df.to_excel(f'{folder_path}/{report_name}.xlsx', index=False)
|
|
333
341
|
|
|
334
342
|
return df
|
|
335
343
|
|
|
@@ -440,29 +448,40 @@ class Report:
|
|
|
440
448
|
|
|
441
449
|
def get_report_pages_and_visuals(
|
|
442
450
|
self,
|
|
443
|
-
report_definition: Dict,
|
|
444
451
|
workspace_id: str,
|
|
445
|
-
report_id: str
|
|
452
|
+
report_id: str,
|
|
453
|
+
operations: Operations) -> pd.DataFrame:
|
|
446
454
|
"""
|
|
447
|
-
|
|
448
|
-
pages-and-visuals parser.
|
|
455
|
+
Fetches report metadata and definition, then delegates to the appropriate
|
|
456
|
+
pages-and-visuals parser based on the report format.
|
|
449
457
|
|
|
450
458
|
Args:
|
|
451
|
-
report_definition (dict): dict with 'format' and 'parts' keys, as
|
|
452
|
-
returned by report_content['definition'] from the Fabric API.
|
|
453
459
|
workspace_id (str): workspace id.
|
|
454
460
|
report_id (str): report id.
|
|
461
|
+
operations (Operations): Operations class instance.
|
|
455
462
|
|
|
456
463
|
Returns:
|
|
457
|
-
pd.DataFrame: one row per visual. Empty DataFrame
|
|
464
|
+
pd.DataFrame: one row per visual. Empty DataFrame on failure or unknown format.
|
|
458
465
|
"""
|
|
459
|
-
|
|
460
|
-
|
|
466
|
+
metadata_result = self.get_report_metadata(workspace_id, report_id)
|
|
467
|
+
if metadata_result.get('message') != 'Success':
|
|
468
|
+
print('get_report_pages_and_visuals: failed to get report metadata.')
|
|
469
|
+
return pd.DataFrame()
|
|
470
|
+
|
|
471
|
+
metadata_format = metadata_result['content'].get('format', '')
|
|
472
|
+
|
|
473
|
+
definition_result = self.get_report_definition(workspace_id, report_id, operations)
|
|
474
|
+
if definition_result.get('message') != 'Success':
|
|
475
|
+
print('get_report_pages_and_visuals: failed to get report definition.')
|
|
476
|
+
return pd.DataFrame()
|
|
477
|
+
|
|
478
|
+
parts = definition_result['content'].get('parts', [])
|
|
479
|
+
fmt = metadata_format.lower()
|
|
461
480
|
|
|
462
481
|
if fmt == 'pbir':
|
|
463
482
|
return self.get_pbir_report_pages_and_visuals(parts, workspace_id, report_id)
|
|
464
483
|
|
|
465
|
-
elif fmt == '
|
|
484
|
+
elif fmt == 'pbirlegacy':
|
|
466
485
|
report_payload = None
|
|
467
486
|
for part in parts:
|
|
468
487
|
if part.get('path') == 'report.json':
|
|
@@ -482,7 +501,7 @@ class Report:
|
|
|
482
501
|
return self.get_legacy_report_pages_and_visuals(json_data, workspace_id, report_id)
|
|
483
502
|
|
|
484
503
|
else:
|
|
485
|
-
print(f'get_report_pages_and_visuals: unsupported format "{
|
|
504
|
+
print(f'get_report_pages_and_visuals: unsupported format "{metadata_format}".')
|
|
486
505
|
return pd.DataFrame()
|
|
487
506
|
|
|
488
507
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|