semantic-link-labs 0.12.3__py3-none-any.whl → 0.12.5__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 (47) hide show
  1. {semantic_link_labs-0.12.3.dist-info → semantic_link_labs-0.12.5.dist-info}/METADATA +5 -3
  2. {semantic_link_labs-0.12.3.dist-info → semantic_link_labs-0.12.5.dist-info}/RECORD +45 -37
  3. sempy_labs/__init__.py +20 -16
  4. sempy_labs/_a_lib_info.py +1 -1
  5. sempy_labs/_authentication.py +1 -1
  6. sempy_labs/_capacities.py +1 -1
  7. sempy_labs/_dataflows.py +98 -10
  8. sempy_labs/_git.py +1 -1
  9. sempy_labs/_helper_functions.py +32 -5
  10. sempy_labs/_list_functions.py +55 -5
  11. sempy_labs/_managed_private_endpoints.py +63 -1
  12. sempy_labs/_model_bpa.py +6 -0
  13. sempy_labs/_notebooks.py +4 -2
  14. sempy_labs/_onelake.py +131 -0
  15. sempy_labs/_sql_audit_settings.py +208 -0
  16. sempy_labs/_sql_endpoints.py +18 -3
  17. sempy_labs/_utils.py +2 -0
  18. sempy_labs/admin/__init__.py +6 -0
  19. sempy_labs/admin/_basic_functions.py +17 -13
  20. sempy_labs/admin/_items.py +3 -3
  21. sempy_labs/admin/_labels.py +211 -0
  22. sempy_labs/admin/_workspaces.py +2 -2
  23. sempy_labs/deployment_pipeline/__init__.py +21 -0
  24. sempy_labs/deployment_pipeline/_items.py +486 -0
  25. sempy_labs/directlake/_update_directlake_partition_entity.py +73 -41
  26. sempy_labs/directlake/_warm_cache.py +3 -1
  27. sempy_labs/eventstream/__init__.py +37 -0
  28. sempy_labs/eventstream/_items.py +263 -0
  29. sempy_labs/eventstream/_topology.py +652 -0
  30. sempy_labs/graph/__init__.py +10 -0
  31. sempy_labs/graph/_groups.py +123 -53
  32. sempy_labs/graph/_sensitivity_labels.py +39 -0
  33. sempy_labs/graph/_teams.py +19 -18
  34. sempy_labs/graph/_user_licenses.py +96 -0
  35. sempy_labs/graph/_users.py +69 -18
  36. sempy_labs/lakehouse/_get_lakehouse_tables.py +33 -1
  37. sempy_labs/lakehouse/_lakehouse.py +6 -2
  38. sempy_labs/lakehouse/_partitioning.py +165 -0
  39. sempy_labs/report/_export_report.py +0 -22
  40. sempy_labs/report/_report_rebind.py +29 -43
  41. sempy_labs/report/_reportwrapper.py +80 -35
  42. sempy_labs/tom/_model.py +81 -4
  43. sempy_labs/_deployment_pipelines.py +0 -209
  44. sempy_labs/_eventstreams.py +0 -123
  45. {semantic_link_labs-0.12.3.dist-info → semantic_link_labs-0.12.5.dist-info}/WHEEL +0 -0
  46. {semantic_link_labs-0.12.3.dist-info → semantic_link_labs-0.12.5.dist-info}/licenses/LICENSE +0 -0
  47. {semantic_link_labs-0.12.3.dist-info → semantic_link_labs-0.12.5.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,211 @@
1
+ from typing import Literal, List
2
+ from uuid import UUID
3
+ import sempy_labs._icons as icons
4
+ from sempy_labs.admin._basic_functions import (
5
+ _resolve_workspace_name_and_id,
6
+ )
7
+ from sempy_labs.admin._items import (
8
+ list_items,
9
+ )
10
+ from sempy_labs._helper_functions import (
11
+ _is_valid_uuid,
12
+ _base_api,
13
+ )
14
+ from sempy._utils._log import log
15
+
16
+
17
+ @log
18
+ def bulk_set_labels(
19
+ items: List[dict],
20
+ label_id: UUID,
21
+ assignment_method: Literal["Standard", "Priviledged"] = "Standard",
22
+ ):
23
+ """
24
+ Sets sensitivity labels on Fabric items.
25
+
26
+ Note: Please use the sempy_labs.graph.resolve_sensitivity_label_id function to retrieve label IDs.
27
+
28
+ This is a wrapper function for the following API: `Labels - Bulk Set Labels <https://learn.microsoft.com/rest/api/fabric/admin/labels/bulk-set-labels>`_.
29
+
30
+ Parameters
31
+ ----------
32
+ items : List[dict]
33
+ A list of dictionaries containing the item details.
34
+
35
+ Example 1:
36
+ items = [
37
+ {
38
+ "id": "fe472f5e-636e-4c10-a1c6-7e9edc0b542a",
39
+ "type": "Dashboard"
40
+ },
41
+ {
42
+ "id": "fe472f5e-636e-4c10-a1c6-7e9edc0b542c",
43
+ "type": "Report"
44
+ },
45
+ {
46
+ "id": "fe472f5e-636e-4c10-a1c6-7e9edc0b542e",
47
+ "type": "SemanticModel"
48
+ },
49
+ ]
50
+
51
+ Example 2:
52
+ items = [
53
+ {
54
+ "id": "Dashboard 1",
55
+ "type": "Dashboard",
56
+ "workspace": "Sales Workspace"
57
+ },
58
+ {
59
+ "id": "Sales Report",
60
+ "type": "Report",
61
+ "workspace": "Sales Workspace"
62
+ },
63
+ {
64
+ "id": "KPI Model",
65
+ "type": "SemanticModel",
66
+ "workspace": "Workspace 2"
67
+ },
68
+ ]
69
+
70
+ label_id : uuid.UUID
71
+ The label ID, which must be in the user's label policy.
72
+ assignment_method : Literal["Standard", "Priviledged"], default="Standard"
73
+ Specifies whether the assigned label was set by an automated process or manually. Additional tenant setting property types may be added over time.
74
+ """
75
+
76
+ if assignment_method not in ["Standard", "Priviledged"]:
77
+ raise ValueError("assignment_method must be either 'Standard' or 'Priviledged'")
78
+
79
+ payload = {"items": []}
80
+ df = list_items()
81
+
82
+ for i in items:
83
+ item = i.get("item")
84
+ type = i.get("type")
85
+ workspace = i.get("workspace")
86
+ if _is_valid_uuid(item):
87
+ payload["items"].append(
88
+ {
89
+ "id": item,
90
+ "type": type,
91
+ }
92
+ )
93
+ else:
94
+ workspace_id = _resolve_workspace_name_and_id(workspace)[1]
95
+ df_filtered = df[
96
+ (df["Item Name"] == item)
97
+ & (df["Type"] == type)
98
+ & (df["Workspace Id"] == workspace_id)
99
+ ]
100
+ if df_filtered.empty:
101
+ raise ValueError(
102
+ f"The item '{item}' of type '{type}' does not exist in workspace '{workspace}'."
103
+ )
104
+ else:
105
+ payload["items"].append(
106
+ {
107
+ "id": df_filtered["Item Id"].iloc[0],
108
+ "type": type,
109
+ }
110
+ )
111
+
112
+ payload["labelId"] = label_id
113
+ payload["assignmentMethod"] = assignment_method
114
+
115
+ _base_api(request="/v1/admin/items/bulkSetLabels", method="post", payload=payload)
116
+
117
+ print(
118
+ f"{icons.green_dot} Labels have been successfully set on the specified items."
119
+ )
120
+
121
+
122
+ @log
123
+ def bulk_remove_labels(
124
+ items: List[dict],
125
+ ):
126
+ """
127
+ Removes sensitivity labels from Fabric items.
128
+
129
+ This is a wrapper function for the following API: `Labels - Bulk Remove Labels <https://learn.microsoft.com/rest/api/fabric/admin/labels/bulk-remove-labels>`_.
130
+
131
+ Parameters
132
+ ----------
133
+ items : List[dict]
134
+ A list of dictionaries containing the item details.
135
+
136
+ Example 1:
137
+ items = [
138
+ {
139
+ "id": "fe472f5e-636e-4c10-a1c6-7e9edc0b542a",
140
+ "type": "Dashboard"
141
+ },
142
+ {
143
+ "id": "fe472f5e-636e-4c10-a1c6-7e9edc0b542c",
144
+ "type": "Report"
145
+ },
146
+ {
147
+ "id": "fe472f5e-636e-4c10-a1c6-7e9edc0b542e",
148
+ "type": "SemanticModel"
149
+ },
150
+ ]
151
+
152
+ Example 2:
153
+ items = [
154
+ {
155
+ "id": "Dashboard 1",
156
+ "type": "Dashboard",
157
+ "workspace": "Sales Workspace"
158
+ },
159
+ {
160
+ "id": "Sales Report",
161
+ "type": "Report",
162
+ "workspace": "Sales Workspace"
163
+ },
164
+ {
165
+ "id": "KPI Model",
166
+ "type": "SemanticModel",
167
+ "workspace": "Workspace 2"
168
+ },
169
+ ]
170
+ """
171
+
172
+ payload = {"items": []}
173
+ df = list_items()
174
+
175
+ for i in items:
176
+ item = i.get("item")
177
+ type = i.get("type")
178
+ workspace = i.get("workspace")
179
+ if _is_valid_uuid(item):
180
+ payload["items"].append(
181
+ {
182
+ "id": item,
183
+ "type": type,
184
+ }
185
+ )
186
+ else:
187
+ workspace_id = _resolve_workspace_name_and_id(workspace)[1]
188
+ df_filtered = df[
189
+ (df["Item Name"] == item)
190
+ & (df["Type"] == type)
191
+ & (df["Workspace Id"] == workspace_id)
192
+ ]
193
+ if df_filtered.empty:
194
+ raise ValueError(
195
+ f"The item '{item}' of type '{type}' does not exist in workspace '{workspace}'."
196
+ )
197
+ else:
198
+ payload["items"].append(
199
+ {
200
+ "id": df_filtered["Item Id"].iloc[0],
201
+ "type": type,
202
+ }
203
+ )
204
+
205
+ _base_api(
206
+ request="/v1/admin/items/bulkRemoveLabels", method="post", payload=payload
207
+ )
208
+
209
+ print(
210
+ f"{icons.green_dot} Labels have been successfully removed from the specified items."
211
+ )
@@ -1,4 +1,4 @@
1
- from .._helper_functions import (
1
+ from sempy_labs._helper_functions import (
2
2
  _base_api,
3
3
  _build_url,
4
4
  _encode_user,
@@ -8,7 +8,7 @@ from .._helper_functions import (
8
8
 
9
9
  from uuid import UUID
10
10
  from typing import Optional
11
- from ._basic_functions import (
11
+ from sempy_labs.admin._basic_functions import (
12
12
  _resolve_workspace_name_and_id,
13
13
  )
14
14
  import sempy_labs._icons as icons
@@ -0,0 +1,21 @@
1
+ from ._items import (
2
+ list_deployment_pipeline_operations,
3
+ list_deployment_pipeline_role_assignments,
4
+ list_deployment_pipeline_stage_items,
5
+ list_deployment_pipeline_stages,
6
+ list_deployment_pipelines,
7
+ unassign_workspace_from_stage,
8
+ assign_workspace_to_stage,
9
+ delete_deployment_pipeline,
10
+ )
11
+
12
+ __all__ = [
13
+ "list_deployment_pipeline_operations",
14
+ "list_deployment_pipeline_role_assignments",
15
+ "list_deployment_pipeline_stage_items",
16
+ "list_deployment_pipeline_stages",
17
+ "list_deployment_pipelines",
18
+ "unassign_workspace_from_stage",
19
+ "assign_workspace_to_stage",
20
+ "delete_deployment_pipeline",
21
+ ]