semantic-link-labs 0.6.0__py3-none-any.whl → 0.7.0__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.7.0.dist-info/METADATA +148 -0
- semantic_link_labs-0.7.0.dist-info/RECORD +111 -0
- {semantic_link_labs-0.6.0.dist-info → semantic_link_labs-0.7.0.dist-info}/WHEEL +1 -1
- sempy_labs/__init__.py +26 -2
- sempy_labs/_ai.py +3 -65
- sempy_labs/_bpa_translation/_translations_am-ET.po +828 -0
- sempy_labs/_bpa_translation/_translations_ar-AE.po +860 -0
- sempy_labs/_bpa_translation/_translations_cs-CZ.po +894 -0
- sempy_labs/_bpa_translation/_translations_da-DK.po +894 -0
- sempy_labs/_bpa_translation/_translations_de-DE.po +933 -0
- sempy_labs/_bpa_translation/_translations_el-GR.po +936 -0
- sempy_labs/_bpa_translation/_translations_es-ES.po +915 -0
- sempy_labs/_bpa_translation/_translations_fa-IR.po +883 -0
- sempy_labs/_bpa_translation/_translations_fr-FR.po +938 -0
- sempy_labs/_bpa_translation/_translations_ga-IE.po +912 -0
- sempy_labs/_bpa_translation/_translations_he-IL.po +855 -0
- sempy_labs/_bpa_translation/_translations_hi-IN.po +892 -0
- sempy_labs/_bpa_translation/_translations_hu-HU.po +910 -0
- sempy_labs/_bpa_translation/_translations_is-IS.po +887 -0
- sempy_labs/_bpa_translation/_translations_it-IT.po +931 -0
- sempy_labs/_bpa_translation/_translations_ja-JP.po +805 -0
- sempy_labs/_bpa_translation/_translations_nl-NL.po +924 -0
- sempy_labs/_bpa_translation/_translations_pl-PL.po +913 -0
- sempy_labs/_bpa_translation/_translations_pt-BR.po +909 -0
- sempy_labs/_bpa_translation/_translations_pt-PT.po +904 -0
- sempy_labs/_bpa_translation/_translations_ru-RU.po +909 -0
- sempy_labs/_bpa_translation/_translations_ta-IN.po +922 -0
- sempy_labs/_bpa_translation/_translations_te-IN.po +896 -0
- sempy_labs/_bpa_translation/_translations_th-TH.po +873 -0
- sempy_labs/_bpa_translation/_translations_zh-CN.po +767 -0
- sempy_labs/_bpa_translation/_translations_zu-ZA.po +916 -0
- sempy_labs/_clear_cache.py +9 -4
- sempy_labs/_generate_semantic_model.py +30 -56
- sempy_labs/_helper_functions.py +358 -14
- sempy_labs/_icons.py +10 -1
- sempy_labs/_list_functions.py +478 -237
- sempy_labs/_model_bpa.py +194 -18
- sempy_labs/_model_bpa_bulk.py +363 -0
- sempy_labs/_model_bpa_rules.py +4 -4
- sempy_labs/_model_dependencies.py +12 -10
- sempy_labs/_one_lake_integration.py +7 -7
- sempy_labs/_query_scale_out.py +45 -66
- sempy_labs/_refresh_semantic_model.py +7 -0
- sempy_labs/_translations.py +154 -1
- sempy_labs/_vertipaq.py +103 -90
- sempy_labs/directlake/__init__.py +5 -1
- sempy_labs/directlake/_directlake_schema_compare.py +27 -31
- sempy_labs/directlake/_directlake_schema_sync.py +55 -66
- sempy_labs/directlake/_dl_helper.py +233 -0
- sempy_labs/directlake/_get_directlake_lakehouse.py +6 -7
- sempy_labs/directlake/_get_shared_expression.py +1 -1
- sempy_labs/directlake/_guardrails.py +17 -13
- sempy_labs/directlake/_update_directlake_partition_entity.py +54 -30
- sempy_labs/directlake/_warm_cache.py +1 -1
- sempy_labs/lakehouse/_get_lakehouse_tables.py +61 -69
- sempy_labs/lakehouse/_lakehouse.py +3 -2
- sempy_labs/lakehouse/_shortcuts.py +1 -1
- sempy_labs/migration/_create_pqt_file.py +174 -182
- sempy_labs/migration/_migrate_calctables_to_lakehouse.py +236 -268
- sempy_labs/migration/_migrate_calctables_to_semantic_model.py +75 -73
- sempy_labs/migration/_migrate_model_objects_to_semantic_model.py +442 -426
- sempy_labs/migration/_migrate_tables_columns_to_semantic_model.py +91 -97
- sempy_labs/migration/_refresh_calc_tables.py +92 -101
- sempy_labs/report/_BPAReportTemplate.json +232 -0
- sempy_labs/report/__init__.py +6 -2
- sempy_labs/report/_bpareporttemplate/.pbi/localSettings.json +9 -0
- sempy_labs/report/_bpareporttemplate/.platform +11 -0
- sempy_labs/report/_bpareporttemplate/StaticResources/SharedResources/BaseThemes/CY24SU06.json +710 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/01d72098bda5055bd500/page.json +11 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/01d72098bda5055bd500/visuals/1b08bce3bebabb0a27a8/visual.json +191 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/01d72098bda5055bd500/visuals/2f22ddb70c301693c165/visual.json +438 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/01d72098bda5055bd500/visuals/3b1182230aa6c600b43a/visual.json +127 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/01d72098bda5055bd500/visuals/58577ba6380c69891500/visual.json +576 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/01d72098bda5055bd500/visuals/a2a8fa5028b3b776c96c/visual.json +207 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/01d72098bda5055bd500/visuals/adfd47ef30652707b987/visual.json +506 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/01d72098bda5055bd500/visuals/b6a80ee459e716e170b1/visual.json +127 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/01d72098bda5055bd500/visuals/ce3130a721c020cc3d81/visual.json +513 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/92735ae19b31712208ad/page.json +8 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/92735ae19b31712208ad/visuals/66e60dfb526437cd78d1/visual.json +112 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/c597da16dc7e63222a82/page.json +11 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/c597da16dc7e63222a82/visuals/07deb8bce824e1be37d7/visual.json +513 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/c597da16dc7e63222a82/visuals/0b1c68838818b32ad03b/visual.json +352 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/c597da16dc7e63222a82/visuals/0c171de9d2683d10b930/visual.json +37 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/c597da16dc7e63222a82/visuals/0efa01be0510e40a645e/visual.json +542 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/c597da16dc7e63222a82/visuals/6bf2f0eb830ab53cc668/visual.json +221 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/c597da16dc7e63222a82/visuals/88d8141cb8500b60030c/visual.json +127 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/c597da16dc7e63222a82/visuals/a753273590beed656a03/visual.json +576 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/c597da16dc7e63222a82/visuals/b8fdc82cddd61ac447bc/visual.json +127 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/d37dce724a0ccc30044b/page.json +9 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/d37dce724a0ccc30044b/visuals/ce8532a7e25020271077/visual.json +38 -0
- sempy_labs/report/_bpareporttemplate/definition/pages/pages.json +10 -0
- sempy_labs/report/_bpareporttemplate/definition/report.json +176 -0
- sempy_labs/report/_bpareporttemplate/definition/version.json +4 -0
- sempy_labs/report/_bpareporttemplate/definition.pbir +14 -0
- sempy_labs/report/_generate_report.py +255 -139
- sempy_labs/report/_report_functions.py +26 -33
- sempy_labs/report/_report_rebind.py +31 -26
- sempy_labs/tom/_model.py +75 -58
- semantic_link_labs-0.6.0.dist-info/METADATA +0 -22
- semantic_link_labs-0.6.0.dist-info/RECORD +0 -54
- sempy_labs/directlake/_fallback.py +0 -60
- {semantic_link_labs-0.6.0.dist-info → semantic_link_labs-0.7.0.dist-info}/LICENSE +0 -0
- {semantic_link_labs-0.6.0.dist-info → semantic_link_labs-0.7.0.dist-info}/top_level.txt +0 -0
sempy_labs/tom/_model.py
CHANGED
|
@@ -6,7 +6,7 @@ from datetime import datetime
|
|
|
6
6
|
from sempy_labs._helper_functions import format_dax_object_name
|
|
7
7
|
from sempy_labs._list_functions import list_relationships
|
|
8
8
|
from sempy_labs._refresh_semantic_model import refresh_semantic_model
|
|
9
|
-
from sempy_labs.directlake.
|
|
9
|
+
from sempy_labs.directlake._dl_helper import check_fallback_reason
|
|
10
10
|
from contextlib import contextmanager
|
|
11
11
|
from typing import List, Iterator, Optional, Union, TYPE_CHECKING
|
|
12
12
|
from sempy._utils._log import log
|
|
@@ -229,6 +229,7 @@ class TOMWrapper:
|
|
|
229
229
|
hidden: Optional[bool] = False,
|
|
230
230
|
description: Optional[str] = None,
|
|
231
231
|
display_folder: Optional[str] = None,
|
|
232
|
+
format_string_expression: Optional[str] = None,
|
|
232
233
|
):
|
|
233
234
|
"""
|
|
234
235
|
Adds a measure to the semantic model.
|
|
@@ -249,6 +250,8 @@ class TOMWrapper:
|
|
|
249
250
|
A description of the measure.
|
|
250
251
|
display_folder : str, default=None
|
|
251
252
|
The display folder in which the measure will reside.
|
|
253
|
+
format_string_expression : str, default=None
|
|
254
|
+
The format string expression.
|
|
252
255
|
"""
|
|
253
256
|
import Microsoft.AnalysisServices.Tabular as TOM
|
|
254
257
|
|
|
@@ -262,6 +265,10 @@ class TOMWrapper:
|
|
|
262
265
|
obj.Description = description
|
|
263
266
|
if display_folder is not None:
|
|
264
267
|
obj.DisplayFolder = display_folder
|
|
268
|
+
if format_string_expression is not None:
|
|
269
|
+
fsd = TOM.FormatStringDefinition()
|
|
270
|
+
fsd.Expression = format_string_expression
|
|
271
|
+
obj.FormatStringDefinition = fsd
|
|
265
272
|
|
|
266
273
|
self.model.Tables[table_name].Measures.Add(obj)
|
|
267
274
|
|
|
@@ -499,8 +506,8 @@ class TOMWrapper:
|
|
|
499
506
|
calculation_item_name: str,
|
|
500
507
|
expression: str,
|
|
501
508
|
ordinal: Optional[int] = None,
|
|
502
|
-
format_string_expression: Optional[str] = None,
|
|
503
509
|
description: Optional[str] = None,
|
|
510
|
+
format_string_expression: Optional[str] = None,
|
|
504
511
|
):
|
|
505
512
|
"""
|
|
506
513
|
Adds a `calculation item <https://learn.microsoft.com/dotnet/api/microsoft.analysisservices.tabular.calculationitem?view=analysisservices-dotnet>`_ to
|
|
@@ -524,7 +531,6 @@ class TOMWrapper:
|
|
|
524
531
|
import Microsoft.AnalysisServices.Tabular as TOM
|
|
525
532
|
|
|
526
533
|
obj = TOM.CalculationItem()
|
|
527
|
-
fsd = TOM.FormatStringDefinition()
|
|
528
534
|
obj.Name = calculation_item_name
|
|
529
535
|
obj.Expression = expression
|
|
530
536
|
if ordinal is not None:
|
|
@@ -532,7 +538,9 @@ class TOMWrapper:
|
|
|
532
538
|
if description is not None:
|
|
533
539
|
obj.Description = description
|
|
534
540
|
if format_string_expression is not None:
|
|
535
|
-
|
|
541
|
+
fsd = TOM.FormatStringDefinition()
|
|
542
|
+
fsd.Expression = format_string_expression
|
|
543
|
+
obj.FormatStringDefinition = fsd
|
|
536
544
|
self.model.Tables[table_name].CalculationGroup.CalculationItems.Add(obj)
|
|
537
545
|
|
|
538
546
|
def add_role(
|
|
@@ -1579,7 +1587,9 @@ class TOMWrapper:
|
|
|
1579
1587
|
except Exception:
|
|
1580
1588
|
pass
|
|
1581
1589
|
|
|
1582
|
-
if objType == TOM.ObjectType.
|
|
1590
|
+
if objType == TOM.ObjectType.Table:
|
|
1591
|
+
object.Parent.Tables.Remove(object.Name)
|
|
1592
|
+
elif objType == TOM.ObjectType.Column:
|
|
1583
1593
|
object.Parent.Columns.Remove(object.Name)
|
|
1584
1594
|
elif objType == TOM.ObjectType.Measure:
|
|
1585
1595
|
object.Parent.Measures.Remove(object.Name)
|
|
@@ -2554,7 +2564,9 @@ class TOMWrapper:
|
|
|
2554
2564
|
t.Partitions.Add(par)
|
|
2555
2565
|
self.model.Tables.Add(t)
|
|
2556
2566
|
|
|
2557
|
-
def add_field_parameter(
|
|
2567
|
+
def add_field_parameter(
|
|
2568
|
+
self, table_name: str, objects: List[str], object_names: List[str] = None
|
|
2569
|
+
):
|
|
2558
2570
|
"""
|
|
2559
2571
|
Adds a `field parameter <https://learn.microsoft.com/power-bi/create-reports/power-bi-field-parameters>`_ to the semantic model.
|
|
2560
2572
|
|
|
@@ -2566,6 +2578,9 @@ class TOMWrapper:
|
|
|
2566
2578
|
The columns/measures to be included in the field parameter.
|
|
2567
2579
|
Columns must be specified as such : 'Table Name'[Column Name].
|
|
2568
2580
|
Measures may be formatted as '[Measure Name]' or 'Measure Name'.
|
|
2581
|
+
object_names : List[str], default=None
|
|
2582
|
+
The corresponding visible name for the measures/columns in the objects list.
|
|
2583
|
+
Defaults to None which shows the measure/column name.
|
|
2569
2584
|
"""
|
|
2570
2585
|
|
|
2571
2586
|
import Microsoft.AnalysisServices.Tabular as TOM
|
|
@@ -2580,38 +2595,30 @@ class TOMWrapper:
|
|
|
2580
2595
|
f"{icons.red_dot} There must be more than one object (column/measure) within the objects parameter."
|
|
2581
2596
|
)
|
|
2582
2597
|
|
|
2598
|
+
if object_names is not None and len(objects) != len(object_names):
|
|
2599
|
+
raise ValueError(
|
|
2600
|
+
f"{icons.red_dot} If the 'object_names' parameter is specified, it must correspond exactly to the 'objects' parameter."
|
|
2601
|
+
)
|
|
2602
|
+
|
|
2583
2603
|
expr = ""
|
|
2584
2604
|
i = 0
|
|
2585
2605
|
for obj in objects:
|
|
2606
|
+
index = objects.index(obj)
|
|
2586
2607
|
success = False
|
|
2587
2608
|
for m in self.all_measures():
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
+ m.Name
|
|
2594
|
-
+ '", NAMEOF(['
|
|
2595
|
-
+ m.Name
|
|
2596
|
-
+ "]), "
|
|
2597
|
-
+ str(i)
|
|
2598
|
-
+ "),"
|
|
2599
|
-
)
|
|
2609
|
+
obj_name = m.Name
|
|
2610
|
+
if obj == f"[{obj_name}]" or obj == obj_name:
|
|
2611
|
+
if object_names is not None:
|
|
2612
|
+
obj_name = object_names[index]
|
|
2613
|
+
expr = f'{expr}\n\t("{obj_name}", NAMEOF([{m.Name}]), {str(i)}),'
|
|
2600
2614
|
success = True
|
|
2601
2615
|
for c in self.all_columns():
|
|
2616
|
+
obj_name = c.Name
|
|
2602
2617
|
fullObjName = format_dax_object_name(c.Parent.Name, c.Name)
|
|
2603
2618
|
if obj == fullObjName or obj == c.Parent.Name + "[" + c.Name + "]":
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
+ '("'
|
|
2608
|
-
+ c.Name
|
|
2609
|
-
+ '", NAMEOF('
|
|
2610
|
-
+ fullObjName
|
|
2611
|
-
+ "), "
|
|
2612
|
-
+ str(i)
|
|
2613
|
-
+ "),"
|
|
2614
|
-
)
|
|
2619
|
+
if object_names is not None:
|
|
2620
|
+
obj_name = object_names[index]
|
|
2621
|
+
expr = f'{expr}\n\t("{obj_name}", NAMEOF({fullObjName}), {str(i)}),'
|
|
2615
2622
|
success = True
|
|
2616
2623
|
if not success:
|
|
2617
2624
|
raise ValueError(
|
|
@@ -3737,9 +3744,9 @@ class TOMWrapper:
|
|
|
3737
3744
|
self,
|
|
3738
3745
|
table_name: str,
|
|
3739
3746
|
partition_name: str,
|
|
3740
|
-
expression: Optional[str
|
|
3741
|
-
mode: Optional[str
|
|
3742
|
-
description: Optional[str
|
|
3747
|
+
expression: Optional[str] = None,
|
|
3748
|
+
mode: Optional[str] = None,
|
|
3749
|
+
description: Optional[str] = None,
|
|
3743
3750
|
):
|
|
3744
3751
|
"""
|
|
3745
3752
|
Updates an M partition for a table within a semantic model.
|
|
@@ -3779,11 +3786,12 @@ class TOMWrapper:
|
|
|
3779
3786
|
def update_measure(
|
|
3780
3787
|
self,
|
|
3781
3788
|
measure_name: str,
|
|
3782
|
-
expression: Optional[str
|
|
3783
|
-
format_string: Optional[str
|
|
3784
|
-
hidden: Optional[bool
|
|
3785
|
-
description: Optional[str
|
|
3786
|
-
display_folder: Optional[str
|
|
3789
|
+
expression: Optional[str] = None,
|
|
3790
|
+
format_string: Optional[str] = None,
|
|
3791
|
+
hidden: Optional[bool] = None,
|
|
3792
|
+
description: Optional[str] = None,
|
|
3793
|
+
display_folder: Optional[str] = None,
|
|
3794
|
+
format_string_expression: Optional[str] = None,
|
|
3787
3795
|
):
|
|
3788
3796
|
"""
|
|
3789
3797
|
Updates a measure within a semantic model.
|
|
@@ -3807,6 +3815,9 @@ class TOMWrapper:
|
|
|
3807
3815
|
display_folder : str, default=None
|
|
3808
3816
|
The display folder in which the measure will reside.
|
|
3809
3817
|
Defaults to None which keeps the existing setting.
|
|
3818
|
+
format_string_expression : str, default=None
|
|
3819
|
+
The format string expression for the calculation item.
|
|
3820
|
+
Defaults to None which keeps the existing setting.
|
|
3810
3821
|
"""
|
|
3811
3822
|
|
|
3812
3823
|
table_name = next(
|
|
@@ -3823,21 +3834,25 @@ class TOMWrapper:
|
|
|
3823
3834
|
m.Description = description
|
|
3824
3835
|
if display_folder is not None:
|
|
3825
3836
|
m.DisplayFolder = display_folder
|
|
3837
|
+
if format_string_expression is not None:
|
|
3838
|
+
fsd = TOM.FormatStringDefinition()
|
|
3839
|
+
fsd.Expression = format_string_expression
|
|
3840
|
+
m.FormatStringDefinition = fsd
|
|
3826
3841
|
|
|
3827
3842
|
def update_column(
|
|
3828
3843
|
self,
|
|
3829
3844
|
table_name: str,
|
|
3830
3845
|
column_name: str,
|
|
3831
|
-
source_column: Optional[str
|
|
3832
|
-
data_type: Optional[str
|
|
3833
|
-
expression: Optional[str
|
|
3834
|
-
format_string: Optional[str
|
|
3835
|
-
hidden: Optional[bool
|
|
3836
|
-
description: Optional[str
|
|
3837
|
-
display_folder: Optional[str
|
|
3838
|
-
data_category: Optional[str
|
|
3839
|
-
key: Optional[bool
|
|
3840
|
-
summarize_by: Optional[str
|
|
3846
|
+
source_column: Optional[str] = None,
|
|
3847
|
+
data_type: Optional[str] = None,
|
|
3848
|
+
expression: Optional[str] = None,
|
|
3849
|
+
format_string: Optional[str] = None,
|
|
3850
|
+
hidden: Optional[bool] = None,
|
|
3851
|
+
description: Optional[str] = None,
|
|
3852
|
+
display_folder: Optional[str] = None,
|
|
3853
|
+
data_category: Optional[str] = None,
|
|
3854
|
+
key: Optional[bool] = None,
|
|
3855
|
+
summarize_by: Optional[str] = None,
|
|
3841
3856
|
):
|
|
3842
3857
|
"""
|
|
3843
3858
|
Updates a column within a semantic model.
|
|
@@ -3910,8 +3925,8 @@ class TOMWrapper:
|
|
|
3910
3925
|
def update_role(
|
|
3911
3926
|
self,
|
|
3912
3927
|
role_name: str,
|
|
3913
|
-
model_permission: Optional[str
|
|
3914
|
-
description: Optional[str
|
|
3928
|
+
model_permission: Optional[str] = None,
|
|
3929
|
+
description: Optional[str] = None,
|
|
3915
3930
|
):
|
|
3916
3931
|
"""
|
|
3917
3932
|
Updates a role within a semantic model.
|
|
@@ -3944,10 +3959,10 @@ class TOMWrapper:
|
|
|
3944
3959
|
self,
|
|
3945
3960
|
table_name: str,
|
|
3946
3961
|
calculation_item_name: str,
|
|
3947
|
-
expression: Optional[str
|
|
3948
|
-
ordinal: Optional[int
|
|
3949
|
-
|
|
3950
|
-
|
|
3962
|
+
expression: Optional[str] = None,
|
|
3963
|
+
ordinal: Optional[int] = None,
|
|
3964
|
+
description: Optional[str] = None,
|
|
3965
|
+
format_string_expression: Optional[str] = None,
|
|
3951
3966
|
):
|
|
3952
3967
|
"""
|
|
3953
3968
|
Updates a calculation item within a semantic model.
|
|
@@ -3964,22 +3979,24 @@ class TOMWrapper:
|
|
|
3964
3979
|
ordinal : int, default=None
|
|
3965
3980
|
The ordinal of the calculation item.
|
|
3966
3981
|
Defaults to None which keeps the existing setting.
|
|
3967
|
-
format_string_expression : str, default=None
|
|
3968
|
-
The format string expression for the calculation item.
|
|
3969
|
-
Defaults to None which keeps the existing setting.
|
|
3970
3982
|
description : str, default=None
|
|
3971
3983
|
The description of the role.
|
|
3972
3984
|
Defaults to None which keeps the existing setting.
|
|
3985
|
+
format_string_expression : str, default=None
|
|
3986
|
+
The format string expression for the calculation item.
|
|
3987
|
+
Defaults to None which keeps the existing setting.
|
|
3973
3988
|
"""
|
|
3974
3989
|
|
|
3975
|
-
obj = self.Tables[table_name].CalculationGroup.CalculationItems[
|
|
3990
|
+
obj = self.model.Tables[table_name].CalculationGroup.CalculationItems[
|
|
3976
3991
|
calculation_item_name
|
|
3977
3992
|
]
|
|
3978
3993
|
|
|
3979
3994
|
if expression is not None:
|
|
3980
3995
|
obj.Expression = expression
|
|
3981
3996
|
if format_string_expression is not None:
|
|
3982
|
-
|
|
3997
|
+
fsd = TOM.FormatStringDefinition()
|
|
3998
|
+
fsd.Expression = format_string_expression
|
|
3999
|
+
obj.FormatStringDefinition.Expression = fsd
|
|
3983
4000
|
if ordinal is not None:
|
|
3984
4001
|
obj.Ordinal = ordinal
|
|
3985
4002
|
if description is not None:
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: semantic-link-labs
|
|
3
|
-
Version: 0.6.0
|
|
4
|
-
Summary: Semantic Link Labs project
|
|
5
|
-
Author: Microsoft Corporation
|
|
6
|
-
License: MIT License
|
|
7
|
-
Project-URL: Repository, https://github.com/microsoft/semantic-link-labs.git
|
|
8
|
-
Classifier: Development Status :: 3 - Alpha
|
|
9
|
-
Classifier: Intended Audience :: Developers
|
|
10
|
-
Classifier: Intended Audience :: Education
|
|
11
|
-
Classifier: Intended Audience :: Science/Research
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
-
Classifier: Framework :: Jupyter
|
|
15
|
-
Requires-Python: <3.12,>=3.10
|
|
16
|
-
License-File: LICENSE
|
|
17
|
-
Requires-Dist: semantic-link-sempy >=0.7.6
|
|
18
|
-
Requires-Dist: anytree
|
|
19
|
-
Requires-Dist: powerbiclient
|
|
20
|
-
Provides-Extra: test
|
|
21
|
-
Requires-Dist: pytest >=8.2.1 ; extra == 'test'
|
|
22
|
-
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
sempy_labs/__init__.py,sha256=T_5thSoxVg83rUR_aac7P4kBKPrf5wylwRAxNMzYkjw,4976
|
|
2
|
-
sempy_labs/_ai.py,sha256=1sWyWxM_fAqdT5Ih2F3QjqWepJ0R48RvffNHSZKfuXs,18079
|
|
3
|
-
sempy_labs/_clear_cache.py,sha256=AfTCAwSK5EYhI2aBPsSun8FxJy-GHlByxH-rBxHfHzM,1362
|
|
4
|
-
sempy_labs/_connections.py,sha256=w1dFC4WeTNFmLGD2EL_Syk0Wb1Eij18we2FVn_VaCD8,7641
|
|
5
|
-
sempy_labs/_dax.py,sha256=dt1GgHceyM7f6phRBPxRKnmQy_KYKpcgFQHuOjGbpLo,2029
|
|
6
|
-
sempy_labs/_generate_semantic_model.py,sha256=qdWL6GDuCstzGLzChNRZ_nr9CndIl-sKmYG1WrZHXcw,9689
|
|
7
|
-
sempy_labs/_helper_functions.py,sha256=bcDDwy7LqOVV3x4scCSBxzMQuU2sLWBzgMSaluDrxEk,14306
|
|
8
|
-
sempy_labs/_icons.py,sha256=RfKaIzFHvu9mtQo6N10w9BQUa9JPHQ6NtJUyASZBdTo,536
|
|
9
|
-
sempy_labs/_list_functions.py,sha256=uNZsQD32jQqQYgOegLYO1m28pRqCpCqZMIm0fyA2QW0,82709
|
|
10
|
-
sempy_labs/_model_auto_build.py,sha256=fX3bCLFCOMQHuheKIoB48fUABG7XAT7qqsMbUiWSrY0,5071
|
|
11
|
-
sempy_labs/_model_bpa.py,sha256=PTC_vKKg-r66o0cXIGsx-0cW2ms-S1mWOLPZW8vGa2Q,14080
|
|
12
|
-
sempy_labs/_model_bpa_rules.py,sha256=aDNudcvBLaKaDLy82MF2D8gbrAtVvrOt9u5AqDkltnk,47291
|
|
13
|
-
sempy_labs/_model_dependencies.py,sha256=0uOhTMLpfhZ0mjIjhKacrvzOYs1uHoFfzc2hqTGAY50,12965
|
|
14
|
-
sempy_labs/_one_lake_integration.py,sha256=r9gnLoFjzfJroAzlJ5aWpKs-rxemzJxnN7tADML0IQc,6246
|
|
15
|
-
sempy_labs/_query_scale_out.py,sha256=-RMDO7T8QsIaDK3xXLyg1eOKXK5sKOBTrIISaKoSFRI,14901
|
|
16
|
-
sempy_labs/_refresh_semantic_model.py,sha256=TGGdqMzpR0POXgaXkqxfD2ene-SwEvU3aujsVlkWX7E,6734
|
|
17
|
-
sempy_labs/_translations.py,sha256=bWlLfz9ynFIQEBRHAWAyV1XZdYTUzLCTtipZKk6Fd_U,12920
|
|
18
|
-
sempy_labs/_vertipaq.py,sha256=pIRfJKjsShxVDdMBoeO97vDvurZ98iblcSdtowSJgxQ,33303
|
|
19
|
-
sempy_labs/directlake/__init__.py,sha256=yDoHDd4TyP7wTTjgMASTsjyXgRrTJwJjgml-IjVl460,1781
|
|
20
|
-
sempy_labs/directlake/_directlake_schema_compare.py,sha256=xljJ60aymEJeQV9w-0NQTzFGA8AUiYvsByX7QqHxglg,4716
|
|
21
|
-
sempy_labs/directlake/_directlake_schema_sync.py,sha256=VzTT9o6xceVfx_8wJkvXwy1jGwjH5HztIrQ_Vwh4B4Q,4940
|
|
22
|
-
sempy_labs/directlake/_fallback.py,sha256=o6FswFiisMVbDqRTCJ2hHa1M65KafkGjaqQl5PQ6szQ,1992
|
|
23
|
-
sempy_labs/directlake/_get_directlake_lakehouse.py,sha256=IkkpJe7iFbKT_9KCMdaLucuw_WCcdmEQd3bz6-Wmgx0,2346
|
|
24
|
-
sempy_labs/directlake/_get_shared_expression.py,sha256=3KIrsaCX-t2r4_anC8Z4MMlbu3Iaa_gCHCC8Ok7NDxA,1936
|
|
25
|
-
sempy_labs/directlake/_guardrails.py,sha256=pnLYM7ZO6_hq38UMNeJRx5Fp9XbcIpgPuAS3py24oA8,2259
|
|
26
|
-
sempy_labs/directlake/_list_directlake_model_calc_tables.py,sha256=_rpnbgsFAz2W16PpgIOB0Rj_Fs1ZKrDbz3DUaaR_bfU,2143
|
|
27
|
-
sempy_labs/directlake/_show_unsupported_directlake_objects.py,sha256=QNj2wHzFGtjnsAICmlc7BuhCYkw0An0XnditDTCG2JM,3358
|
|
28
|
-
sempy_labs/directlake/_update_directlake_model_lakehouse_connection.py,sha256=b_Y5_GSfWC25wH6R7L37-AHO9fvKkmxRGaP6dVDC7-w,3233
|
|
29
|
-
sempy_labs/directlake/_update_directlake_partition_entity.py,sha256=nMh2CqQrp64NipmryuLKewljmFt6aVKaecIwSedIFIw,7687
|
|
30
|
-
sempy_labs/directlake/_warm_cache.py,sha256=RjpRjtzSaKw6gHKPw4O6phBwmnk7LHp4B1yrW8Z6VEY,8242
|
|
31
|
-
sempy_labs/lakehouse/__init__.py,sha256=i6VRx4dR1SIN-1GxioiNwhC4FxbozRCIz5TfXjb9rKc,587
|
|
32
|
-
sempy_labs/lakehouse/_get_lakehouse_columns.py,sha256=Bb_iCTlNwl0wdN4dW_E7tVnfbHhHwQT_l0SUqvcbYpo,2582
|
|
33
|
-
sempy_labs/lakehouse/_get_lakehouse_tables.py,sha256=c2pqEyhiEJhnRaE3Zlz3EHRmR9bFI6J7CZxqLVa87iE,9091
|
|
34
|
-
sempy_labs/lakehouse/_lakehouse.py,sha256=kUMiGi8SyY4oTWAB4OFzGQzlqUdAF2EolpZza15gFrE,2763
|
|
35
|
-
sempy_labs/lakehouse/_shortcuts.py,sha256=oDYexjMxZX2JoaEqSyO1R_PQ2c5qTUNVbHGtVQJZorg,6977
|
|
36
|
-
sempy_labs/migration/__init__.py,sha256=w4vvGk6wTWXVfofJDmio2yIFvSSJsxOpjv6mvNGmrOI,1043
|
|
37
|
-
sempy_labs/migration/_create_pqt_file.py,sha256=XTG1BQJbfgKpwT8jKWrlCfDuMYdecM94qTLzrpQ7wck,9035
|
|
38
|
-
sempy_labs/migration/_migrate_calctables_to_lakehouse.py,sha256=6Z1DIdZCi_LX0o-SfPO5zzqWa0hd_zEwcQzIsOer9SM,20551
|
|
39
|
-
sempy_labs/migration/_migrate_calctables_to_semantic_model.py,sha256=Ne-2_PwW_LUR8vG2pNY3lxa9iib1dIpYkDHRaqyqyY8,6420
|
|
40
|
-
sempy_labs/migration/_migrate_model_objects_to_semantic_model.py,sha256=T7Ijo9g9AmB8KMyqvYOTurSdabUKKaRcfdstSgL1QQ8,24399
|
|
41
|
-
sempy_labs/migration/_migrate_tables_columns_to_semantic_model.py,sha256=1ZWQ9sawd2_ojTnWTsRaDEj7yMnUVOpCQZeI0YHhb-g,7066
|
|
42
|
-
sempy_labs/migration/_migration_validation.py,sha256=phbUUIYA5z4dZvEKrVbByMTPPwMscY7Dy9HVxE8z_HM,2483
|
|
43
|
-
sempy_labs/migration/_refresh_calc_tables.py,sha256=pImD8wMOMxs043e6s4G2TPrFzsGVHklK1aez_oVOgro,6086
|
|
44
|
-
sempy_labs/report/__init__.py,sha256=78lLE4UlmwfSY-6FxMIgnshMQF90Qfq_qM7A3vrNtHw,848
|
|
45
|
-
sempy_labs/report/_generate_report.py,sha256=fJUiUgsF2mS-dyaVjRvwAASvbSrSm8BUDB53Ru3rhQI,8545
|
|
46
|
-
sempy_labs/report/_report_functions.py,sha256=6xpLyVrRkA2ZwwCj2By8_HX2k-EHoQUZtuUaTy0d7vM,30004
|
|
47
|
-
sempy_labs/report/_report_rebind.py,sha256=PmZ3f3Rf3Yka8Eaea87JosSiFvEtzjfbUDQOzRx_vlQ,4614
|
|
48
|
-
sempy_labs/tom/__init__.py,sha256=Qbs8leW0fjzvWwOjyWK3Hjeehu7IvpB1beASGsi28bk,121
|
|
49
|
-
sempy_labs/tom/_model.py,sha256=kGRfpA6IHy8KX6QKVciekOa2Y97d6r0eRol5K8YMMIg,149938
|
|
50
|
-
semantic_link_labs-0.6.0.dist-info/LICENSE,sha256=ws_MuBL-SCEBqPBFl9_FqZkaaydIJmxHrJG2parhU4M,1141
|
|
51
|
-
semantic_link_labs-0.6.0.dist-info/METADATA,sha256=ZFdW982vsZ0btahdjKpAgiDMEXxnjn_nwiPY8iMMrdI,764
|
|
52
|
-
semantic_link_labs-0.6.0.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
|
|
53
|
-
semantic_link_labs-0.6.0.dist-info/top_level.txt,sha256=kiQX1y42Dbein1l3Q8jMUYyRulDjdlc2tMepvtrvixQ,11
|
|
54
|
-
semantic_link_labs-0.6.0.dist-info/RECORD,,
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import sempy.fabric as fabric
|
|
2
|
-
import numpy as np
|
|
3
|
-
from typing import Optional
|
|
4
|
-
import sempy_labs._icons as icons
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def check_fallback_reason(dataset: str, workspace: Optional[str] = None):
|
|
8
|
-
"""
|
|
9
|
-
Shows the reason a table in a Direct Lake semantic model would fallback to DirectQuery.
|
|
10
|
-
|
|
11
|
-
Parameters
|
|
12
|
-
----------
|
|
13
|
-
dataset : str
|
|
14
|
-
Name of the semantic model.
|
|
15
|
-
workspace : str, default=None
|
|
16
|
-
The Fabric workspace name.
|
|
17
|
-
Defaults to None which resolves to the workspace of the attached lakehouse
|
|
18
|
-
or if no lakehouse attached, resolves to the workspace of the notebook.
|
|
19
|
-
|
|
20
|
-
Returns
|
|
21
|
-
-------
|
|
22
|
-
pandas.DataFrame
|
|
23
|
-
The tables in the semantic model and their fallback reason.
|
|
24
|
-
"""
|
|
25
|
-
|
|
26
|
-
workspace = fabric.resolve_workspace_name(workspace)
|
|
27
|
-
|
|
28
|
-
dfP = fabric.list_partitions(dataset=dataset, workspace=workspace)
|
|
29
|
-
dfP_filt = dfP[dfP["Mode"] == "DirectLake"]
|
|
30
|
-
|
|
31
|
-
if len(dfP_filt) == 0:
|
|
32
|
-
raise ValueError(
|
|
33
|
-
f"{icons.red_dot} The '{dataset}' semantic model is not in Direct Lake. This function is only applicable to Direct Lake semantic models."
|
|
34
|
-
)
|
|
35
|
-
else:
|
|
36
|
-
df = fabric.evaluate_dax(
|
|
37
|
-
dataset=dataset,
|
|
38
|
-
workspace=workspace,
|
|
39
|
-
dax_string="""
|
|
40
|
-
SELECT [TableName] AS [Table Name],[FallbackReason] AS [FallbackReasonID]
|
|
41
|
-
FROM $SYSTEM.TMSCHEMA_DELTA_TABLE_METADATA_STORAGES
|
|
42
|
-
""",
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
value_mapping = {
|
|
46
|
-
0: "No reason for fallback",
|
|
47
|
-
1: "This table is not framed",
|
|
48
|
-
2: "This object is a view in the lakehouse",
|
|
49
|
-
3: "The table does not exist in the lakehouse",
|
|
50
|
-
4: "Transient error",
|
|
51
|
-
5: "Using OLS will result in fallback to DQ",
|
|
52
|
-
6: "Using RLS will result in fallback to DQ",
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
# Create a new column based on the mapping
|
|
56
|
-
df["Fallback Reason Detail"] = np.vectorize(value_mapping.get)(
|
|
57
|
-
df["FallbackReasonID"]
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
return df
|
|
File without changes
|
|
File without changes
|