semantic-link-labs 0.7.4__py3-none-any.whl → 0.8.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.

Files changed (32) hide show
  1. {semantic_link_labs-0.7.4.dist-info → semantic_link_labs-0.8.0.dist-info}/METADATA +7 -3
  2. {semantic_link_labs-0.7.4.dist-info → semantic_link_labs-0.8.0.dist-info}/RECORD +32 -23
  3. {semantic_link_labs-0.7.4.dist-info → semantic_link_labs-0.8.0.dist-info}/WHEEL +1 -1
  4. sempy_labs/__init__.py +57 -18
  5. sempy_labs/_capacities.py +39 -3
  6. sempy_labs/_capacity_migration.py +624 -0
  7. sempy_labs/_clear_cache.py +8 -8
  8. sempy_labs/_connections.py +15 -13
  9. sempy_labs/_git.py +20 -21
  10. sempy_labs/_helper_functions.py +33 -30
  11. sempy_labs/_icons.py +19 -0
  12. sempy_labs/_list_functions.py +210 -0
  13. sempy_labs/_model_bpa.py +1 -1
  14. sempy_labs/_query_scale_out.py +4 -3
  15. sempy_labs/_spark.py +31 -36
  16. sempy_labs/_sql.py +60 -15
  17. sempy_labs/_vertipaq.py +9 -7
  18. sempy_labs/admin/__init__.py +53 -0
  19. sempy_labs/admin/_basic_functions.py +806 -0
  20. sempy_labs/admin/_domains.py +411 -0
  21. sempy_labs/directlake/_generate_shared_expression.py +11 -14
  22. sempy_labs/directlake/_update_directlake_model_lakehouse_connection.py +14 -24
  23. sempy_labs/report/__init__.py +9 -6
  24. sempy_labs/report/_report_bpa.py +359 -0
  25. sempy_labs/report/_report_bpa_rules.py +113 -0
  26. sempy_labs/report/_report_helper.py +254 -0
  27. sempy_labs/report/_report_list_functions.py +95 -0
  28. sempy_labs/report/_report_rebind.py +0 -4
  29. sempy_labs/report/_reportwrapper.py +2039 -0
  30. sempy_labs/tom/_model.py +78 -4
  31. {semantic_link_labs-0.7.4.dist-info → semantic_link_labs-0.8.0.dist-info}/LICENSE +0 -0
  32. {semantic_link_labs-0.7.4.dist-info → semantic_link_labs-0.8.0.dist-info}/top_level.txt +0 -0
sempy_labs/tom/_model.py CHANGED
@@ -230,7 +230,10 @@ class TOMWrapper:
230
230
  description: Optional[str] = None,
231
231
  display_folder: Optional[str] = None,
232
232
  format_string_expression: Optional[str] = None,
233
+ data_category: Optional[str] = None,
234
+ lineage_tag: Optional[str] = None,
233
235
  source_lineage_tag: Optional[str] = None,
236
+ detail_rows_expression: Optional[str] = None,
234
237
  ):
235
238
  """
236
239
  Adds a measure to the semantic model.
@@ -253,8 +256,14 @@ class TOMWrapper:
253
256
  The display folder in which the measure will reside.
254
257
  format_string_expression : str, default=None
255
258
  The format string expression.
259
+ data_category : str, default=None
260
+ Specifies the type of data contained in the measure so that you can add custom behaviors based on measure type.
261
+ lineage_tag : str, default=None
262
+ A tag that represents the lineage of the object.
256
263
  source_lineage_tag : str, default=None
257
264
  A tag that represents the lineage of the source for the object.
265
+ detail_rows_expression : str, default=None
266
+ The detail rows expression.
258
267
  """
259
268
  import Microsoft.AnalysisServices.Tabular as TOM
260
269
 
@@ -272,8 +281,16 @@ class TOMWrapper:
272
281
  fsd = TOM.FormatStringDefinition()
273
282
  fsd.Expression = format_string_expression
274
283
  obj.FormatStringDefinition = fsd
284
+ if lineage_tag is not None:
285
+ obj.LineageTag = lineage_tag
275
286
  if source_lineage_tag is not None:
276
287
  obj.SourceLineageTag = source_lineage_tag
288
+ if detail_rows_expression is not None:
289
+ drd = TOM.DetailRowsDefinition()
290
+ drd.Expression = detail_rows_expression
291
+ obj.DetailRowsDefinition = drd
292
+ if data_category is not None:
293
+ obj.DataCategory = data_category
277
294
 
278
295
  self.model.Tables[table_name].Measures.Add(obj)
279
296
 
@@ -290,6 +307,7 @@ class TOMWrapper:
290
307
  data_category: Optional[str] = None,
291
308
  key: Optional[bool] = False,
292
309
  summarize_by: Optional[str] = None,
310
+ lineage_tag: Optional[str] = None,
293
311
  source_lineage_tag: Optional[str] = None,
294
312
  ):
295
313
  """
@@ -320,6 +338,8 @@ class TOMWrapper:
320
338
  summarize_by : str, default=None
321
339
  Sets the value for the Summarize By property of the column.
322
340
  Defaults to None resolves to 'Default'.
341
+ lineage_tag : str, default=None
342
+ A tag that represents the lineage of the object.
323
343
  source_lineage_tag : str, default=None
324
344
  A tag that represents the lineage of the source for the object.
325
345
  """
@@ -354,6 +374,8 @@ class TOMWrapper:
354
374
  obj.DisplayFolder = display_folder
355
375
  if data_category is not None:
356
376
  obj.DataCategory = data_category
377
+ if lineage_tag is not None:
378
+ obj.LineageTag = lineage_tag
357
379
  if source_lineage_tag is not None:
358
380
  obj.SourceLineageTag = source_lineage_tag
359
381
  self.model.Tables[table_name].Columns.Add(obj)
@@ -371,6 +393,7 @@ class TOMWrapper:
371
393
  data_category: Optional[str] = None,
372
394
  key: Optional[bool] = False,
373
395
  summarize_by: Optional[str] = None,
396
+ lineage_tag: Optional[str] = None,
374
397
  source_lineage_tag: Optional[str] = None,
375
398
  ):
376
399
  """
@@ -401,6 +424,8 @@ class TOMWrapper:
401
424
  summarize_by : str, default=None
402
425
  Sets the value for the Summarize By property of the column.
403
426
  Defaults to None resolves to 'Default'.
427
+ lineage_tag : str, default=None
428
+ A tag that represents the lineage of the object.
404
429
  source_lineage_tag : str, default=None
405
430
  A tag that represents the lineage of the source for the object.
406
431
  """
@@ -435,6 +460,8 @@ class TOMWrapper:
435
460
  obj.DisplayFolder = display_folder
436
461
  if data_category is not None:
437
462
  obj.DataCategory = data_category
463
+ if lineage_tag is not None:
464
+ obj.LineageTag = lineage_tag
438
465
  if source_lineage_tag is not None:
439
466
  obj.SourceLineageTag = source_lineage_tag
440
467
  self.model.Tables[table_name].Columns.Add(obj)
@@ -452,6 +479,7 @@ class TOMWrapper:
452
479
  data_category: Optional[str] = None,
453
480
  key: Optional[bool] = False,
454
481
  summarize_by: Optional[str] = None,
482
+ lineage_tag: Optional[str] = None,
455
483
  source_lineage_tag: Optional[str] = None,
456
484
  ):
457
485
  """
@@ -482,6 +510,8 @@ class TOMWrapper:
482
510
  summarize_by : str, default=None
483
511
  Sets the value for the Summarize By property of the column.
484
512
  Defaults to None which resolves to 'Default'.
513
+ lineage_tag : str, default=None
514
+ A tag that represents the lineage of the object.
485
515
  source_lineage_tag : str, default=None
486
516
  A tag that represents the lineage of the source for the object.
487
517
  """
@@ -516,6 +546,8 @@ class TOMWrapper:
516
546
  obj.DisplayFolder = display_folder
517
547
  if data_category is not None:
518
548
  obj.DataCategory = data_category
549
+ if lineage_tag is not None:
550
+ obj.LineageTag = lineage_tag
519
551
  if source_lineage_tag is not None:
520
552
  obj.SourceLineageTag = source_lineage_tag
521
553
  self.model.Tables[table_name].Columns.Add(obj)
@@ -677,6 +709,7 @@ class TOMWrapper:
677
709
  levels: Optional[List[str]] = None,
678
710
  hierarchy_description: Optional[str] = None,
679
711
  hierarchy_hidden: Optional[bool] = False,
712
+ lineage_tag: Optional[str] = None,
680
713
  source_lineage_tag: Optional[str] = None,
681
714
  ):
682
715
  """
@@ -696,6 +729,8 @@ class TOMWrapper:
696
729
  A description of the hierarchy.
697
730
  hierarchy_hidden : bool, default=False
698
731
  Whether the hierarchy is visible or hidden.
732
+ lineage_tag : str, default=None
733
+ A tag that represents the lineage of the object.
699
734
  source_lineage_tag : str, default=None
700
735
  A tag that represents the lineage of the source for the object.
701
736
  """
@@ -724,6 +759,8 @@ class TOMWrapper:
724
759
  obj.IsHidden = hierarchy_hidden
725
760
  if hierarchy_description is not None:
726
761
  obj.Description = hierarchy_description
762
+ if lineage_tag is not None:
763
+ obj.LineageTag = lineage_tag
727
764
  if source_lineage_tag is not None:
728
765
  obj.SourceLineageTag = source_lineage_tag
729
766
  self.model.Tables[table_name].Hierarchies.Add(obj)
@@ -875,6 +912,7 @@ class TOMWrapper:
875
912
  name: str,
876
913
  expression: str,
877
914
  description: Optional[str] = None,
915
+ lineage_tag: Optional[str] = None,
878
916
  source_lineage_tag: Optional[str] = None,
879
917
  ):
880
918
  """
@@ -888,6 +926,8 @@ class TOMWrapper:
888
926
  The M expression of the expression.
889
927
  description : str, default=None
890
928
  A description of the expression.
929
+ lineage_tag : str, default=None
930
+ A tag that represents the lineage of the object.
891
931
  source_lineage_tag : str, default=None
892
932
  A tag that represents the lineage of the source for the object.
893
933
  """
@@ -897,6 +937,8 @@ class TOMWrapper:
897
937
  exp.Name = name
898
938
  if description is not None:
899
939
  exp.Description = description
940
+ if lineage_tag is not None:
941
+ exp.LineageTag = lineage_tag
900
942
  if source_lineage_tag is not None:
901
943
  exp.SourceLineageTag = source_lineage_tag
902
944
  exp.Kind = TOM.ExpressionKind.M
@@ -992,6 +1034,7 @@ class TOMWrapper:
992
1034
  entity_name: str,
993
1035
  expression: Optional[str] = None,
994
1036
  description: Optional[str] = None,
1037
+ schema_name: Optional[str] = None,
995
1038
  ):
996
1039
  """
997
1040
  Adds an entity partition to a table within a semantic model.
@@ -1001,12 +1044,14 @@ class TOMWrapper:
1001
1044
  table_name : str
1002
1045
  Name of the table.
1003
1046
  entity_name : str
1004
- Name of the lakehouse table.
1047
+ Name of the lakehouse/warehouse table.
1005
1048
  expression : TOM Object, default=None
1006
1049
  The expression used by the table.
1007
1050
  Defaults to None which resolves to the 'DatabaseQuery' expression.
1008
1051
  description : str, default=None
1009
1052
  A description for the partition.
1053
+ schema_name : str, default=None
1054
+ The schema name.
1010
1055
  """
1011
1056
  import Microsoft.AnalysisServices.Tabular as TOM
1012
1057
 
@@ -1017,6 +1062,8 @@ class TOMWrapper:
1017
1062
  ep.ExpressionSource = self.model.Expressions["DatabaseQuery"]
1018
1063
  else:
1019
1064
  ep.ExpressionSource = self.model.Expressions[expression]
1065
+ if schema_name is not None:
1066
+ ep.SchemaName = schema_name
1020
1067
  p = TOM.Partition()
1021
1068
  p.Name = table_name
1022
1069
  p.Source = ep
@@ -1605,13 +1652,25 @@ class TOMWrapper:
1605
1652
  objType = object.ObjectType
1606
1653
 
1607
1654
  # Have to remove translations and perspectives on the object before removing it.
1608
- if objType in ["Table", "Column", "Measure", "Hierarchy", "Level"]:
1655
+ if objType in [
1656
+ TOM.ObjectType.Table,
1657
+ TOM.ObjectType.Column,
1658
+ TOM.ObjectType.Measure,
1659
+ TOM.ObjectType.Hierarchy,
1660
+ TOM.ObjectType.Level,
1661
+ ]:
1609
1662
  for lang in object.Model.Cultures:
1610
1663
  try:
1611
1664
  self.remove_translation(object=object, language=lang.Name)
1612
1665
  except Exception:
1613
1666
  pass
1614
- if objType in ["Table", "Column", "Measure", "Hierarchy"]:
1667
+ if objType in [
1668
+ TOM.ObjectType.Table,
1669
+ TOM.ObjectType.Column,
1670
+ TOM.ObjectType.Measure,
1671
+ TOM.ObjectType.Hierarchy,
1672
+ TOM.ObjectType.Level,
1673
+ ]:
1615
1674
  for persp in object.Model.Perspectives:
1616
1675
  try:
1617
1676
  self.remove_from_perspective(
@@ -2528,6 +2587,7 @@ class TOMWrapper:
2528
2587
  description: Optional[str] = None,
2529
2588
  data_category: Optional[str] = None,
2530
2589
  hidden: Optional[bool] = False,
2590
+ lineage_tag: Optional[str] = None,
2531
2591
  source_lineage_tag: Optional[str] = None,
2532
2592
  ):
2533
2593
  """
@@ -2543,6 +2603,8 @@ class TOMWrapper:
2543
2603
  The data category for the table.
2544
2604
  hidden : bool, default=False
2545
2605
  Whether the table is hidden or visible.
2606
+ lineage_tag : str, default=None
2607
+ A tag that represents the lineage of the object.
2546
2608
  source_lineage_tag : str, default=None
2547
2609
  A tag that represents the lineage of the source for the object.
2548
2610
  """
@@ -2554,6 +2616,8 @@ class TOMWrapper:
2554
2616
  t.Description = description
2555
2617
  if data_category is not None:
2556
2618
  t.DataCategory = data_category
2619
+ if lineage_tag is not None:
2620
+ t.LineageTag = lineage_tag
2557
2621
  if source_lineage_tag is not None:
2558
2622
  t.SourceLineageTag = source_lineage_tag
2559
2623
  t.Hidden = hidden
@@ -2566,6 +2630,8 @@ class TOMWrapper:
2566
2630
  description: Optional[str] = None,
2567
2631
  data_category: Optional[str] = None,
2568
2632
  hidden: Optional[bool] = False,
2633
+ lineage_tag: Optional[bool] = None,
2634
+ source_lineage_tag: Optional[bool] = None,
2569
2635
  ):
2570
2636
  """
2571
2637
  Adds a calculated table to the semantic model.
@@ -2582,6 +2648,10 @@ class TOMWrapper:
2582
2648
  The data category for the table.
2583
2649
  hidden : bool, default=False
2584
2650
  Whether the table is hidden or visible.
2651
+ lineage_tag : str, default=None
2652
+ A tag that represents the lineage of the object.
2653
+ source_lineage_tag : str, default=None
2654
+ A tag that represents the lineage of the source for the object.
2585
2655
  """
2586
2656
  import Microsoft.AnalysisServices.Tabular as TOM
2587
2657
 
@@ -2598,6 +2668,10 @@ class TOMWrapper:
2598
2668
  t.Description = description
2599
2669
  if data_category is not None:
2600
2670
  t.DataCategory = data_category
2671
+ if lineage_tag is not None:
2672
+ t.LineageTag = lineage_tag
2673
+ if source_lineage_tag is not None:
2674
+ t.SourceLineageTag = source_lineage_tag
2601
2675
  t.Hidden = hidden
2602
2676
  t.Partitions.Add(par)
2603
2677
  self.model.Tables.Add(t)
@@ -3941,7 +4015,7 @@ class TOMWrapper:
3941
4015
  import Microsoft.AnalysisServices.Tabular as TOM
3942
4016
  import System
3943
4017
 
3944
- c = self.model.Tables[table_name].Measures[column_name]
4018
+ c = self.model.Tables[table_name].Columns[column_name]
3945
4019
  if c.Type == TOM.ColumnType.Data:
3946
4020
  if source_column is not None:
3947
4021
  c.SourceColumn = source_column