semantic-link-labs 0.9.1__py3-none-any.whl → 0.9.2__py3-none-any.whl
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.
Potentially problematic release.
This version of semantic-link-labs might be problematic. Click here for more details.
- {semantic_link_labs-0.9.1.dist-info → semantic_link_labs-0.9.2.dist-info}/METADATA +66 -8
- {semantic_link_labs-0.9.1.dist-info → semantic_link_labs-0.9.2.dist-info}/RECORD +82 -75
- sempy_labs/__init__.py +14 -12
- sempy_labs/_capacities.py +120 -142
- sempy_labs/_capacity_migration.py +61 -94
- sempy_labs/_clear_cache.py +9 -8
- sempy_labs/_connections.py +72 -105
- sempy_labs/_data_pipelines.py +47 -49
- sempy_labs/_dataflows.py +45 -51
- sempy_labs/_dax.py +228 -6
- sempy_labs/_delta_analyzer.py +303 -0
- sempy_labs/_deployment_pipelines.py +72 -66
- sempy_labs/_environments.py +39 -36
- sempy_labs/_eventhouses.py +35 -35
- sempy_labs/_eventstreams.py +38 -39
- sempy_labs/_external_data_shares.py +29 -42
- sempy_labs/_gateways.py +57 -101
- sempy_labs/_generate_semantic_model.py +22 -30
- sempy_labs/_git.py +46 -66
- sempy_labs/_graphQL.py +95 -0
- sempy_labs/_helper_functions.py +175 -30
- sempy_labs/_job_scheduler.py +47 -59
- sempy_labs/_kql_databases.py +27 -34
- sempy_labs/_kql_querysets.py +23 -30
- sempy_labs/_list_functions.py +262 -164
- sempy_labs/_managed_private_endpoints.py +52 -47
- sempy_labs/_mirrored_databases.py +110 -134
- sempy_labs/_mirrored_warehouses.py +13 -13
- sempy_labs/_ml_experiments.py +36 -36
- sempy_labs/_ml_models.py +37 -38
- sempy_labs/_model_dependencies.py +2 -0
- sempy_labs/_notebooks.py +28 -29
- sempy_labs/_one_lake_integration.py +2 -0
- sempy_labs/_query_scale_out.py +63 -81
- sempy_labs/_refresh_semantic_model.py +12 -14
- sempy_labs/_spark.py +54 -79
- sempy_labs/_sql.py +7 -11
- sempy_labs/_vertipaq.py +8 -3
- sempy_labs/_warehouses.py +30 -33
- sempy_labs/_workloads.py +15 -20
- sempy_labs/_workspace_identity.py +13 -17
- sempy_labs/_workspaces.py +49 -48
- sempy_labs/admin/__init__.py +2 -0
- sempy_labs/admin/_basic_functions.py +244 -281
- sempy_labs/admin/_domains.py +188 -103
- sempy_labs/admin/_external_data_share.py +26 -31
- sempy_labs/admin/_git.py +17 -22
- sempy_labs/admin/_items.py +34 -48
- sempy_labs/admin/_scanner.py +20 -13
- sempy_labs/directlake/_directlake_schema_compare.py +2 -0
- sempy_labs/directlake/_dl_helper.py +10 -11
- sempy_labs/directlake/_generate_shared_expression.py +4 -5
- sempy_labs/directlake/_get_directlake_lakehouse.py +1 -0
- sempy_labs/directlake/_list_directlake_model_calc_tables.py +1 -0
- sempy_labs/directlake/_show_unsupported_directlake_objects.py +2 -0
- sempy_labs/directlake/_warm_cache.py +2 -0
- sempy_labs/graph/__init__.py +33 -0
- sempy_labs/graph/_groups.py +402 -0
- sempy_labs/graph/_teams.py +113 -0
- sempy_labs/graph/_users.py +191 -0
- sempy_labs/lakehouse/__init__.py +4 -0
- sempy_labs/lakehouse/_get_lakehouse_columns.py +10 -10
- sempy_labs/lakehouse/_get_lakehouse_tables.py +14 -20
- sempy_labs/lakehouse/_lakehouse.py +101 -4
- sempy_labs/lakehouse/_shortcuts.py +42 -20
- sempy_labs/migration/__init__.py +4 -0
- sempy_labs/migration/_direct_lake_to_import.py +66 -0
- sempy_labs/migration/_migrate_calctables_to_lakehouse.py +1 -0
- sempy_labs/migration/_migrate_calctables_to_semantic_model.py +1 -0
- sempy_labs/migration/_migrate_model_objects_to_semantic_model.py +1 -0
- sempy_labs/migration/_migrate_tables_columns_to_semantic_model.py +2 -0
- sempy_labs/report/_download_report.py +8 -13
- sempy_labs/report/_generate_report.py +49 -46
- sempy_labs/report/_paginated.py +20 -26
- sempy_labs/report/_report_functions.py +50 -45
- sempy_labs/report/_report_list_functions.py +2 -0
- sempy_labs/report/_report_rebind.py +6 -10
- sempy_labs/report/_reportwrapper.py +187 -220
- sempy_labs/tom/_model.py +8 -5
- {semantic_link_labs-0.9.1.dist-info → semantic_link_labs-0.9.2.dist-info}/LICENSE +0 -0
- {semantic_link_labs-0.9.1.dist-info → semantic_link_labs-0.9.2.dist-info}/WHEEL +0 -0
- {semantic_link_labs-0.9.1.dist-info → semantic_link_labs-0.9.2.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import sempy.fabric as fabric
|
|
2
1
|
from sempy_labs._helper_functions import (
|
|
3
2
|
resolve_report_id,
|
|
4
3
|
format_dax_object_name,
|
|
@@ -6,9 +5,11 @@ from sempy_labs._helper_functions import (
|
|
|
6
5
|
_conv_b64,
|
|
7
6
|
_extract_json,
|
|
8
7
|
_add_part,
|
|
9
|
-
lro,
|
|
10
8
|
_decode_b64,
|
|
11
9
|
resolve_workspace_name_and_id,
|
|
10
|
+
_update_dataframe_datatypes,
|
|
11
|
+
_base_api,
|
|
12
|
+
_create_dataframe,
|
|
12
13
|
)
|
|
13
14
|
from typing import Optional, List
|
|
14
15
|
import pandas as pd
|
|
@@ -21,6 +22,7 @@ import sempy_labs.report._report_helper as helper
|
|
|
21
22
|
from sempy_labs._model_dependencies import get_measure_dependencies
|
|
22
23
|
from jsonpath_ng.ext import parse
|
|
23
24
|
import warnings
|
|
25
|
+
import requests
|
|
24
26
|
|
|
25
27
|
|
|
26
28
|
class ReportWrapper:
|
|
@@ -144,14 +146,14 @@ class ReportWrapper:
|
|
|
144
146
|
|
|
145
147
|
def update_report(self, request_body: dict):
|
|
146
148
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
_base_api(
|
|
150
|
+
request=f"/v1/workspaces/{self._workspace_id}/reports/{self._report_id}/updateDefinition",
|
|
151
|
+
method="post",
|
|
152
|
+
payload=request_body,
|
|
153
|
+
lro_return_status_code=True,
|
|
154
|
+
status_codes=None,
|
|
151
155
|
)
|
|
152
156
|
|
|
153
|
-
lro(client, response, return_status_code=True)
|
|
154
|
-
|
|
155
157
|
def resolve_page_name(self, page_display_name: str) -> UUID:
|
|
156
158
|
"""
|
|
157
159
|
Obtains the page name, page display name, and the file path for a given page in a report.
|
|
@@ -253,7 +255,13 @@ class ReportWrapper:
|
|
|
253
255
|
|
|
254
256
|
helper.populate_custom_visual_display_names()
|
|
255
257
|
|
|
256
|
-
|
|
258
|
+
columns = {
|
|
259
|
+
"Custom Visual Name": "str",
|
|
260
|
+
"Custom Visual Display Name": "str",
|
|
261
|
+
"Used in Report": "bool",
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
df = _create_dataframe(columns=columns)
|
|
257
265
|
rd = self.rdef
|
|
258
266
|
rd_filt = rd[rd["path"] == "definition/report.json"]
|
|
259
267
|
rptJson = _extract_json(rd_filt)
|
|
@@ -266,8 +274,7 @@ class ReportWrapper:
|
|
|
266
274
|
self.list_visuals()["Type"]
|
|
267
275
|
)
|
|
268
276
|
|
|
269
|
-
|
|
270
|
-
df[bool_cols] = df[bool_cols].astype(bool)
|
|
277
|
+
_update_dataframe_datatypes(dataframe=df, column_map=columns)
|
|
271
278
|
|
|
272
279
|
return df
|
|
273
280
|
|
|
@@ -289,19 +296,18 @@ class ReportWrapper:
|
|
|
289
296
|
|
|
290
297
|
rd_filt = self.rdef[self.rdef["path"] == "definition/report.json"]
|
|
291
298
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
)
|
|
299
|
+
columns = {
|
|
300
|
+
"Filter Name": "str",
|
|
301
|
+
"Type": "str",
|
|
302
|
+
"Table Name": "str",
|
|
303
|
+
"Object Name": "str",
|
|
304
|
+
"Object Type": "str",
|
|
305
|
+
"Hidden": "bool",
|
|
306
|
+
"Locked": "bool",
|
|
307
|
+
"How Created": "str",
|
|
308
|
+
"Used": "bool",
|
|
309
|
+
}
|
|
310
|
+
df = _create_dataframe(columns=columns)
|
|
305
311
|
|
|
306
312
|
if len(rd_filt) == 1:
|
|
307
313
|
rpt_json = _extract_json(rd_filt)
|
|
@@ -333,8 +339,7 @@ class ReportWrapper:
|
|
|
333
339
|
[df, pd.DataFrame(new_data, index=[0])], ignore_index=True
|
|
334
340
|
)
|
|
335
341
|
|
|
336
|
-
|
|
337
|
-
df[bool_cols] = df[bool_cols].astype(bool)
|
|
342
|
+
_update_dataframe_datatypes(dataframe=df, column_map=columns)
|
|
338
343
|
|
|
339
344
|
if extended:
|
|
340
345
|
df = self._add_extended(dataframe=df)
|
|
@@ -357,24 +362,22 @@ class ReportWrapper:
|
|
|
357
362
|
A pandas dataframe containing a list of all the page filters used in the report.
|
|
358
363
|
"""
|
|
359
364
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
]
|
|
375
|
-
)
|
|
365
|
+
columns = {
|
|
366
|
+
"Page Name": "str",
|
|
367
|
+
"Page Display Name": "str",
|
|
368
|
+
"Filter Name": "str",
|
|
369
|
+
"Type": "str",
|
|
370
|
+
"Table Name": "str",
|
|
371
|
+
"Object Name": "str",
|
|
372
|
+
"Object Type": "str",
|
|
373
|
+
"Hidden": "bool",
|
|
374
|
+
"Locked": "bool",
|
|
375
|
+
"How Created": "str",
|
|
376
|
+
"Used": "bool",
|
|
377
|
+
}
|
|
378
|
+
df = _create_dataframe(columns=columns)
|
|
376
379
|
|
|
377
|
-
for _, r in
|
|
380
|
+
for _, r in self.rdef.iterrows():
|
|
378
381
|
path = r["path"]
|
|
379
382
|
payload = r["payload"]
|
|
380
383
|
if path.endswith("/page.json"):
|
|
@@ -420,14 +423,12 @@ class ReportWrapper:
|
|
|
420
423
|
lambda page_name: f"{helper.get_web_url(report=self._report, workspace=self._workspace_id)}/{page_name}"
|
|
421
424
|
)
|
|
422
425
|
|
|
423
|
-
|
|
424
|
-
df[bool_cols] = df[bool_cols].astype(bool)
|
|
426
|
+
_update_dataframe_datatypes(dataframe=df, column_map=columns)
|
|
425
427
|
|
|
426
428
|
if extended:
|
|
427
429
|
df = self._add_extended(dataframe=df)
|
|
428
430
|
|
|
429
431
|
return df
|
|
430
|
-
# return df.style.format({"Page URL": _make_clickable})
|
|
431
432
|
|
|
432
433
|
def list_visual_filters(self, extended: bool = False) -> pd.DataFrame:
|
|
433
434
|
"""
|
|
@@ -445,26 +446,25 @@ class ReportWrapper:
|
|
|
445
446
|
A pandas dataframe containing a list of all the visual filters used in the report.
|
|
446
447
|
"""
|
|
447
448
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
)
|
|
449
|
+
columns = {
|
|
450
|
+
"Page Name": "str",
|
|
451
|
+
"Page Display Name": "str",
|
|
452
|
+
"Visual Name": "str",
|
|
453
|
+
"Filter Name": "str",
|
|
454
|
+
"Type": "str",
|
|
455
|
+
"Table Name": "str",
|
|
456
|
+
"Object Name": "str",
|
|
457
|
+
"Object Type": "str",
|
|
458
|
+
"Hidden": "bool",
|
|
459
|
+
"Locked": "bool",
|
|
460
|
+
"How Created": "str",
|
|
461
|
+
"Used": "bool",
|
|
462
|
+
}
|
|
463
|
+
df = _create_dataframe(columns=columns)
|
|
464
|
+
|
|
465
465
|
page_mapping, visual_mapping = helper.visual_page_mapping(self)
|
|
466
466
|
|
|
467
|
-
for _, r in
|
|
467
|
+
for _, r in self.rdef.iterrows():
|
|
468
468
|
path = r["path"]
|
|
469
469
|
payload = r["payload"]
|
|
470
470
|
if path.endswith("/visual.json"):
|
|
@@ -508,8 +508,7 @@ class ReportWrapper:
|
|
|
508
508
|
ignore_index=True,
|
|
509
509
|
)
|
|
510
510
|
|
|
511
|
-
|
|
512
|
-
df[bool_cols] = df[bool_cols].astype(bool)
|
|
511
|
+
_update_dataframe_datatypes(dataframe=df, column_map=columns)
|
|
513
512
|
|
|
514
513
|
if extended:
|
|
515
514
|
df = self._add_extended(dataframe=df)
|
|
@@ -529,18 +528,16 @@ class ReportWrapper:
|
|
|
529
528
|
A pandas dataframe containing a list of all modified visual interactions used in the report.
|
|
530
529
|
"""
|
|
531
530
|
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
]
|
|
541
|
-
)
|
|
531
|
+
columns = {
|
|
532
|
+
"Page Name": "str",
|
|
533
|
+
"Page Display Name": "str",
|
|
534
|
+
"Source Visual Name": "str",
|
|
535
|
+
"Target Visual Name": "str",
|
|
536
|
+
"Type": "str",
|
|
537
|
+
}
|
|
538
|
+
df = _create_dataframe(columns=columns)
|
|
542
539
|
|
|
543
|
-
for _, r in
|
|
540
|
+
for _, r in self.rdef.iterrows():
|
|
544
541
|
file_path = r["path"]
|
|
545
542
|
payload = r["payload"]
|
|
546
543
|
if file_path.endswith("/page.json"):
|
|
@@ -577,31 +574,30 @@ class ReportWrapper:
|
|
|
577
574
|
A pandas dataframe containing a list of all pages in the report.
|
|
578
575
|
"""
|
|
579
576
|
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
)
|
|
577
|
+
columns = {
|
|
578
|
+
"File Path": "str",
|
|
579
|
+
"Page Name": "str",
|
|
580
|
+
"Page Display Name": "str",
|
|
581
|
+
"Hidden": "bool",
|
|
582
|
+
"Active": "bool",
|
|
583
|
+
"Width": "int",
|
|
584
|
+
"Height": "int",
|
|
585
|
+
"Display Option": "str",
|
|
586
|
+
"Type": "str",
|
|
587
|
+
"Alignment": "str",
|
|
588
|
+
"Drillthrough Target Page": "bool",
|
|
589
|
+
"Visual Count": "int",
|
|
590
|
+
"Data Visual Count": "int",
|
|
591
|
+
"Visible Visual Count": "int",
|
|
592
|
+
"Page Filter Count": "int",
|
|
593
|
+
"Page URL": "str",
|
|
594
|
+
}
|
|
595
|
+
df = _create_dataframe(columns=columns)
|
|
600
596
|
|
|
601
597
|
dfV = self.list_visuals()
|
|
602
598
|
|
|
603
|
-
page_rows =
|
|
604
|
-
pages_row =
|
|
599
|
+
page_rows = self.rdef[self.rdef["path"].str.endswith("/page.json")]
|
|
600
|
+
pages_row = self.rdef[self.rdef["path"] == "definition/pages/pages.json"]
|
|
605
601
|
|
|
606
602
|
for _, r in page_rows.iterrows():
|
|
607
603
|
file_path = r["path"]
|
|
@@ -633,9 +629,9 @@ class ReportWrapper:
|
|
|
633
629
|
# )
|
|
634
630
|
|
|
635
631
|
visual_count = len(
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
& (
|
|
632
|
+
self.rdef[
|
|
633
|
+
self.rdef["path"].str.endswith("/visual.json")
|
|
634
|
+
& (self.rdef["path"].str.startswith(page_prefix))
|
|
639
635
|
]
|
|
640
636
|
)
|
|
641
637
|
data_visual_count = len(
|
|
@@ -681,23 +677,12 @@ class ReportWrapper:
|
|
|
681
677
|
|
|
682
678
|
df.loc[df["Page Name"] == activePage, "Active"] = True
|
|
683
679
|
|
|
684
|
-
int_cols = [
|
|
685
|
-
"Width",
|
|
686
|
-
"Height",
|
|
687
|
-
"Page Filter Count",
|
|
688
|
-
"Visual Count",
|
|
689
|
-
"Visible Visual Count",
|
|
690
|
-
"Data Visual Count",
|
|
691
|
-
]
|
|
692
|
-
df[int_cols] = df[int_cols].astype(int)
|
|
693
|
-
|
|
694
|
-
bool_cols = ["Hidden", "Active", "Drillthrough Target Page"]
|
|
695
|
-
df[bool_cols] = df[bool_cols].astype(bool)
|
|
696
|
-
|
|
697
680
|
df["Page URL"] = df["Page Name"].apply(
|
|
698
681
|
lambda page_name: f"{helper.get_web_url(report=self._report, workspace=self._workspace_id)}/{page_name}"
|
|
699
682
|
)
|
|
700
683
|
|
|
684
|
+
_update_dataframe_datatypes(dataframe=df, column_map=columns)
|
|
685
|
+
|
|
701
686
|
return df
|
|
702
687
|
# return df.style.format({"Page URL": _make_clickable})
|
|
703
688
|
|
|
@@ -711,39 +696,37 @@ class ReportWrapper:
|
|
|
711
696
|
A pandas dataframe containing a list of all visuals in the report.
|
|
712
697
|
"""
|
|
713
698
|
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
]
|
|
744
|
-
)
|
|
699
|
+
columns = {
|
|
700
|
+
"File Path": "str",
|
|
701
|
+
"Page Name": "str",
|
|
702
|
+
"Page Display Name": "str",
|
|
703
|
+
"Visual Name": "str",
|
|
704
|
+
"Type": "str",
|
|
705
|
+
"Display Type": "str",
|
|
706
|
+
"X": "float",
|
|
707
|
+
"Y": "float",
|
|
708
|
+
"Z": "int",
|
|
709
|
+
"Width": "float",
|
|
710
|
+
"Height": "float",
|
|
711
|
+
"Tab Order": "str",
|
|
712
|
+
"Hidden": "bool",
|
|
713
|
+
"Title": "str",
|
|
714
|
+
"SubTitle": "str",
|
|
715
|
+
"Custom Visual": "bool",
|
|
716
|
+
"Alt Text": "str",
|
|
717
|
+
"Show Items With No Data": "bool",
|
|
718
|
+
"Divider": "str",
|
|
719
|
+
"Slicer Type": "str",
|
|
720
|
+
"Row SubTotals": "bool",
|
|
721
|
+
"Column SubTotals": "bool",
|
|
722
|
+
"Data Visual": "bool",
|
|
723
|
+
"Has Sparkline": "bool",
|
|
724
|
+
"Visual Filter Count": "int",
|
|
725
|
+
"Data Limit": "int",
|
|
726
|
+
}
|
|
727
|
+
df = _create_dataframe(columns=columns)
|
|
745
728
|
|
|
746
|
-
rd_filt =
|
|
729
|
+
rd_filt = self.rdef[self.rdef["path"] == "definition/report.json"]
|
|
747
730
|
payload = rd_filt["payload"].iloc[0]
|
|
748
731
|
rptJson = _extract_json(rd_filt)
|
|
749
732
|
custom_visuals = rptJson.get("publicCustomVisuals", [])
|
|
@@ -765,7 +748,7 @@ class ReportWrapper:
|
|
|
765
748
|
|
|
766
749
|
return any(key in all_keys for key in keys_to_check)
|
|
767
750
|
|
|
768
|
-
for _, r in
|
|
751
|
+
for _, r in self.rdef.iterrows():
|
|
769
752
|
file_path = r["path"]
|
|
770
753
|
payload = r["payload"]
|
|
771
754
|
if file_path.endswith("/visual.json"):
|
|
@@ -910,16 +893,6 @@ class ReportWrapper:
|
|
|
910
893
|
[df, pd.DataFrame(new_data, index=[0])], ignore_index=True
|
|
911
894
|
)
|
|
912
895
|
|
|
913
|
-
bool_cols = [
|
|
914
|
-
"Hidden",
|
|
915
|
-
"Show Items With No Data",
|
|
916
|
-
"Custom Visual",
|
|
917
|
-
"Data Visual",
|
|
918
|
-
"Has Sparkline",
|
|
919
|
-
"Row SubTotals",
|
|
920
|
-
"Column SubTotals",
|
|
921
|
-
]
|
|
922
|
-
|
|
923
896
|
grouped_df = (
|
|
924
897
|
self.list_visual_objects()
|
|
925
898
|
.groupby(["Page Name", "Visual Name"])
|
|
@@ -936,11 +909,7 @@ class ReportWrapper:
|
|
|
936
909
|
)
|
|
937
910
|
df["Visual Object Count"] = df["Visual Object Count"].fillna(0).astype(int)
|
|
938
911
|
|
|
939
|
-
|
|
940
|
-
int_cols = ["Z", "Visual Filter Count", "Data Limit", "Visual Object Count"]
|
|
941
|
-
df[bool_cols] = df[bool_cols].astype(bool)
|
|
942
|
-
df[int_cols] = df[int_cols].astype(int)
|
|
943
|
-
df[float_cols] = df[float_cols].astype(float)
|
|
912
|
+
_update_dataframe_datatypes(dataframe=df, column_map=columns)
|
|
944
913
|
|
|
945
914
|
return df
|
|
946
915
|
|
|
@@ -960,23 +929,22 @@ class ReportWrapper:
|
|
|
960
929
|
A pandas dataframe containing a list of all semantic model objects used in each visual in the report.
|
|
961
930
|
"""
|
|
962
931
|
|
|
963
|
-
rd = self.rdef
|
|
964
932
|
page_mapping, visual_mapping = helper.visual_page_mapping(self)
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
)
|
|
933
|
+
|
|
934
|
+
columns = {
|
|
935
|
+
"Page Name": "str",
|
|
936
|
+
"Page Display Name": "str",
|
|
937
|
+
"Visual Name": "str",
|
|
938
|
+
"Table Name": "str",
|
|
939
|
+
"Object Name": "str",
|
|
940
|
+
"Object Type": "str",
|
|
941
|
+
"Implicit Measure": "bool",
|
|
942
|
+
"Sparkline": "bool",
|
|
943
|
+
"Visual Calc": "bool",
|
|
944
|
+
"Format": "str",
|
|
945
|
+
"Object Display Name": "str",
|
|
946
|
+
}
|
|
947
|
+
df = _create_dataframe(columns=columns)
|
|
980
948
|
|
|
981
949
|
def contains_key(data, keys_to_check):
|
|
982
950
|
if isinstance(data, dict):
|
|
@@ -1032,7 +1000,7 @@ class ReportWrapper:
|
|
|
1032
1000
|
|
|
1033
1001
|
return result
|
|
1034
1002
|
|
|
1035
|
-
for _, r in
|
|
1003
|
+
for _, r in self.rdef.iterrows():
|
|
1036
1004
|
file_path = r["path"]
|
|
1037
1005
|
payload = r["payload"]
|
|
1038
1006
|
if file_path.endswith("/visual.json"):
|
|
@@ -1089,8 +1057,7 @@ class ReportWrapper:
|
|
|
1089
1057
|
if extended:
|
|
1090
1058
|
df = self._add_extended(dataframe=df)
|
|
1091
1059
|
|
|
1092
|
-
|
|
1093
|
-
df[bool_cols] = df[bool_cols].astype(bool)
|
|
1060
|
+
_update_dataframe_datatypes(dataframe=df, column_map=columns)
|
|
1094
1061
|
|
|
1095
1062
|
return df
|
|
1096
1063
|
|
|
@@ -1113,16 +1080,15 @@ class ReportWrapper:
|
|
|
1113
1080
|
|
|
1114
1081
|
from sempy_labs.tom import connect_semantic_model
|
|
1115
1082
|
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
]
|
|
1124
|
-
)
|
|
1083
|
+
columns = {
|
|
1084
|
+
"Table Name": "str",
|
|
1085
|
+
"Object Name": "str",
|
|
1086
|
+
"Object Type": "str",
|
|
1087
|
+
"Report Source": "str",
|
|
1088
|
+
"Report Source Object": "str",
|
|
1089
|
+
}
|
|
1125
1090
|
|
|
1091
|
+
df = _create_dataframe(columns=columns)
|
|
1126
1092
|
rf = self.list_report_filters()
|
|
1127
1093
|
pf = self.list_page_filters()
|
|
1128
1094
|
vf = self.list_visual_filters()
|
|
@@ -1257,17 +1223,17 @@ class ReportWrapper:
|
|
|
1257
1223
|
"""
|
|
1258
1224
|
|
|
1259
1225
|
rd = self.rdef
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
)
|
|
1226
|
+
|
|
1227
|
+
columns = {
|
|
1228
|
+
"File Path": "str",
|
|
1229
|
+
"Bookmark Name": "str",
|
|
1230
|
+
"Bookmark Display Name": "str",
|
|
1231
|
+
"Page Name": "str",
|
|
1232
|
+
"Page Display Name": "str",
|
|
1233
|
+
"Visual Name": "str",
|
|
1234
|
+
"Visual Hidden": "bool",
|
|
1235
|
+
}
|
|
1236
|
+
df = _create_dataframe(columns=columns)
|
|
1271
1237
|
|
|
1272
1238
|
bookmark_rows = rd[rd["path"].str.endswith(".bookmark.json")]
|
|
1273
1239
|
|
|
@@ -1320,8 +1286,7 @@ class ReportWrapper:
|
|
|
1320
1286
|
[df, pd.DataFrame(new_data, index=[0])], ignore_index=True
|
|
1321
1287
|
)
|
|
1322
1288
|
|
|
1323
|
-
|
|
1324
|
-
df[bool_cols] = df[bool_cols].astype(bool)
|
|
1289
|
+
_update_dataframe_datatypes(dataframe=df, column_map=columns)
|
|
1325
1290
|
|
|
1326
1291
|
return df
|
|
1327
1292
|
|
|
@@ -1338,17 +1303,17 @@ class ReportWrapper:
|
|
|
1338
1303
|
A pandas dataframe containing a list of all report-level measures in the report.
|
|
1339
1304
|
"""
|
|
1340
1305
|
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
)
|
|
1350
|
-
|
|
1351
|
-
rd_filt =
|
|
1306
|
+
columns = {
|
|
1307
|
+
"Measure Name": "str",
|
|
1308
|
+
"Table Name": "str",
|
|
1309
|
+
"Expression": "str",
|
|
1310
|
+
"Data Type": "str",
|
|
1311
|
+
"Format String": "str",
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
df = _create_dataframe(columns=columns)
|
|
1315
|
+
|
|
1316
|
+
rd_filt = self.rdef[self.rdef["path"] == "definition/reportExtensions.json"]
|
|
1352
1317
|
|
|
1353
1318
|
if len(rd_filt) == 1:
|
|
1354
1319
|
payload = rd_filt["payload"].iloc[0]
|
|
@@ -1386,9 +1351,13 @@ class ReportWrapper:
|
|
|
1386
1351
|
A pandas dataframe showing a list of report, page and visual annotations in the report.
|
|
1387
1352
|
"""
|
|
1388
1353
|
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1354
|
+
columns = {
|
|
1355
|
+
"Type": "str",
|
|
1356
|
+
"Object Name": "str",
|
|
1357
|
+
"Annotation Name": "str",
|
|
1358
|
+
"Annotation Value": "str",
|
|
1359
|
+
}
|
|
1360
|
+
df = _create_dataframe(columns=columns)
|
|
1392
1361
|
|
|
1393
1362
|
page_mapping, visual_mapping = helper.visual_page_mapping(self)
|
|
1394
1363
|
for _, r in self.rdef.iterrows():
|
|
@@ -1454,8 +1423,6 @@ class ReportWrapper:
|
|
|
1454
1423
|
Example for web url: file_path = 'https://raw.githubusercontent.com/PowerBiDevCamp/FabricUserApiDemo/main/FabricUserApiDemo/DefinitionTemplates/Shared/Reports/StaticResources/SharedResources/BaseThemes/CY23SU08.json'
|
|
1455
1424
|
"""
|
|
1456
1425
|
|
|
1457
|
-
import requests
|
|
1458
|
-
|
|
1459
1426
|
report_path = "definition/report.json"
|
|
1460
1427
|
theme_version = "5.5.4"
|
|
1461
1428
|
request_body = {"definition": {"parts": []}}
|
sempy_labs/tom/_model.py
CHANGED
|
@@ -9,6 +9,7 @@ from sempy_labs._helper_functions import (
|
|
|
9
9
|
_make_list_unique,
|
|
10
10
|
resolve_dataset_name_and_id,
|
|
11
11
|
resolve_workspace_name_and_id,
|
|
12
|
+
_base_api,
|
|
12
13
|
)
|
|
13
14
|
from sempy_labs._list_functions import list_relationships
|
|
14
15
|
from sempy_labs._refresh_semantic_model import refresh_semantic_model
|
|
@@ -17,7 +18,6 @@ from contextlib import contextmanager
|
|
|
17
18
|
from typing import List, Iterator, Optional, Union, TYPE_CHECKING
|
|
18
19
|
from sempy._utils._log import log
|
|
19
20
|
import sempy_labs._icons as icons
|
|
20
|
-
from sempy.fabric.exceptions import FabricHTTPException
|
|
21
21
|
import ast
|
|
22
22
|
from uuid import UUID
|
|
23
23
|
import sempy_labs._authentication as auth
|
|
@@ -2965,6 +2965,8 @@ class TOMWrapper:
|
|
|
2965
2965
|
|
|
2966
2966
|
from sempy_labs._list_functions import list_tables
|
|
2967
2967
|
|
|
2968
|
+
fabric.refresh_tom_cache(workspace=self._workspace_id)
|
|
2969
|
+
|
|
2968
2970
|
dfT = list_tables(
|
|
2969
2971
|
dataset=self._dataset_id, workspace=self._workspace_id, extended=True
|
|
2970
2972
|
)
|
|
@@ -4518,10 +4520,11 @@ class TOMWrapper:
|
|
|
4518
4520
|
"modelItems"
|
|
4519
4521
|
].append(new_item)
|
|
4520
4522
|
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4523
|
+
response = _base_api(
|
|
4524
|
+
request="/explore/v202304/nl2nl/completions",
|
|
4525
|
+
method="post",
|
|
4526
|
+
payload=payload,
|
|
4527
|
+
)
|
|
4525
4528
|
|
|
4526
4529
|
for item in response.json().get("modelItems", []):
|
|
4527
4530
|
ms_name = item["urn"]
|
|
File without changes
|